diff options
440 files changed, 10949 insertions, 6095 deletions
diff --git a/.travis.yml b/.travis.yml index fe91fe78c8..aea2b8ed0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,5 +39,5 @@ script: - travis/phing-sniff.sh $DB $TRAVIS_PHP_VERSION - travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION - phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysqli' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3.3' -a '$DB' = 'mysqli' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi" diff --git a/build/build.xml b/build/build.xml index 510e7d0955..ca71aae924 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-b5-dev" /> - <property name="prevversion" value="3.1.0-b4" /> - <property name="olderversions" value="3.0.12, 3.1.0-a1, 3.1.0-a2, 3.1.0-a3, 3.1.0-b1, 3.1.0-b2, 3.1.0-b3" /> + <property name="newversion" value="3.1.0-RC3-dev" /> + <property name="prevversion" value="3.1.0-RC2" /> + <property name="olderversions" value="3.0.12, 3.1.0-a1, 3.1.0-a2, 3.1.0-a3, 3.1.0-b1, 3.1.0-b2, 3.1.0-b3, 3.1.0-b4, 3.1.0-RC1" /> <!-- no configuration should be needed beyond this point --> <property name="oldversions" value="${olderversions}, ${prevversion}" /> @@ -77,16 +77,17 @@ <exec command="phpBB/vendor/bin/phpcs -s --extensions=php - --standard=build/code_sniffer/ruleset-php-strict.xml + --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 --extensions=php - --standard=build/code_sniffer/ruleset-php-legacy.xml + --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/* @@ -96,10 +97,19 @@ --ignore=${project.basedir}/phpBB/vendor/* phpBB" dir="." returnProperty="retval-php-legacy" passthru="true" /> + <exec command="phpBB/vendor/bin/phpcs + -s + --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." /> @@ -249,7 +259,7 @@ command="git archive ${revision} composer.phar | tar -xf - -C ${dir}" checkreturn="true" /> <exec dir="${dir}" - command="php composer.phar install --no-dev" + command="php composer.phar install --no-dev --optimize-autoloader" checkreturn="true" passthru="true" /> <delete file="${dir}/composer.phar" /> diff --git a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php index fcf53b5061..fa7d3b40c1 100644 --- a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php +++ b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php @@ -12,9 +12,8 @@ */ /** -* 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> @@ -47,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); @@ -66,65 +65,68 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff $phpcsFile->addError('Missing required file doc comment.', $stackPtr); return; } - + // Find comment end token $end = $phpcsFile->findNext(T_DOC_COMMENT, $start + 1, null, true) - 1; - + // 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 ($i = $start + 1, $c = $end - 1; $i <= $c; ++$i) { $line = $tokens[$i]['content']; // Check that each line starts with a '*' if (substr($line, 0, 1) !== '*') { - $message = 'The file doc comment should not be idented.'; + $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); + if (!isset($tags[$match[1]])) + { + $tags[$match[1]] = array(); + } + + $tags[$match[1]][] = array($match[2], $i); } } - + // Check that the first and last line is empty if (trim($tokens[$start + 1]['content']) !== '*') { $message = 'The first file comment line should be empty.'; - $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); + $phpcsFile->addWarning($message, ($start + 1)); + } + if (trim($tokens[$end - 1]['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, $tags); + $this->processLicense($phpcsFile, $start, $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'])) @@ -134,80 +136,87 @@ 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-2.0.php GNU General Public License v2'; - - 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>'; + + if (!isset($tags['copyright'])) + { + $message = 'Missing require @copyright tag in file doc comment.'; + $phpcsFile->addError($message, $ptr); + } + else if ($tags['copyright'][0][0] !== $copyright) + { + $message = 'Invalid content found for the first @copyright tag, use "' . $copyright . '".'; + $phpcsFile->addError($message, $tags['copyright'][0][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 = 'GNU General Public License, version 2 (GPL-2.0)'; + + if (!isset($tags['license'])) + { + $message = 'Missing require @license tag in file doc comment.'; + $phpcsFile->addError($message, $ptr); + } + else if (sizeof($tags['license']) !== 1) + { + $message = 'It must be only one @license tag in file doc comment.'; + $phpcsFile->addError($message, $ptr); + } + else if (trim($tags['license'][0][0]) !== $license) + { + $message = 'Invalid content found for @license tag, use ' + . '"' . $license . '".'; + $phpcsFile->addError($message, $tags['license'][0][1]); + } + } } 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..f81ec46579 --- /dev/null +++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.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. +* +*/ + +/** +* Checks that each use statement is used. +*/ +class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff +{ + /** + * {@inheritdoc} + */ + public function register() + { + return array(T_USE); + } + + /** + * {@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)); + $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))); + + if ($simple_class_name === $class_name_full) + { + $error = 'Either use statement or full name must be used.'; + $phpcsFile->addError($error, $simple_statement, 'FullName'); + } + + if ($simple_class_name === $class_name_short) + { + $ok = true; + } + } + } + + // 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))); + + if ($paamayim_nekudotayim_class_name === $class_name_full) + { + $error = 'Either use statement or full name must be used.'; + $phpcsFile->addError($error, $paamayim_nekudotayim, 'FullName'); + } + + if ($paamayim_nekudotayim_class_name === $class_name_short) + { + $ok = true; + } + } + + // 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))); + + if ($implements_class_name === $class_name_full) + { + $error = 'Either use statement or full name must be used.'; + $phpcsFile->addError($error, $implements, 'FullName'); + } + + if ($implements_class_name === $class_name_short) + { + $ok = true; + } + } + } + + // 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; + + $end_function = $phpcsFile->findNext(array(T_CLOSE_PARENTHESIS), ($function_declaration + 1)); + $old_argument = $function_declaration; + while (($argument = $phpcsFile->findNext(T_VARIABLE, ($old_argument + 1), $end_function)) !== false) + { + $old_argument = $argument; + + $start_argument = $phpcsFile->findPrevious(array(T_OPEN_PARENTHESIS, T_COMMA), $argument); + $argument_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($start_argument + 1), $argument); + + // Skip the parameter if no type is defined. + if ($argument_class_name_start !== false) + { + $argument_class_name_end = $phpcsFile->findNext($find, ($argument_class_name_start + 1), null, true); + + $argument_class_name = $phpcsFile->getTokensAsString($argument_class_name_start, ($argument_class_name_end - $argument_class_name_start - 1)); + + if ($argument_class_name === $class_name_full) + { + $error = 'Either use statement or full name must be used.'; + $phpcsFile->addError($error, $function_declaration, 'FullName'); + } + + if ($argument_class_name === $class_name_short) + { + $ok = true; + } + } + } + } + + 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 23aaa45bd3..0000000000 --- a/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.com> -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -/** -* 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 b94186ab6c..0000000000 --- a/build/code_sniffer/phpbb/phpbbCodingStandard.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.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 (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-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-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 c722f7851c..9e2f0664d8 100644 --- a/build/code_sniffer/ruleset-php-strict.xml +++ b/build/code_sniffer/ruleset-php-strict.xml @@ -39,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 d66238e471..c0db0c4011 100755 --- a/build/package.php +++ b/build/package.php @@ -195,12 +195,6 @@ 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( 'copied' => false, 'copy' => array( @@ -269,6 +263,42 @@ if (sizeof($package->old_packages)) } } + /** + * 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/install_*' => '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 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/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index 0e3b5ff3b2..59b10f597e 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> diff --git a/phpBB/adm/style/acp_ban.html b/phpBB/adm/style/acp_ban.html index 71c737de70..9e9f05120a 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 = ''; + } } // ]]> diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index f8ea284acb..af79791ff8 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -284,12 +284,12 @@ <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_FREQ}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_FREQ_EXPLAIN}</span></dt> - <dd><input type="number" id="prune_shadow_freq" name="prune_shadow_freq" value="{PRUNE_FREQ}" maxlength="4" size="4" min="0" max="9999" /> {L_DAYS}</dd> + <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_DAYS}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_DAYS_EXPLAIN}</span></dt> - <dd><input type="number" id="prune_shadow_days" name="prune_shadow_days" value="{PRUNE_DAYS}" maxlength="4" size="4" min="0" max="9999" /> {L_DAYS}</dd> + <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> </fieldset> </div> diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index f9846ea7cd..6049673e0a 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -117,7 +117,7 @@ <dl> <dt><label>{L_AVATAR_TYPE}{L_COLON}</label></dt> <dd><select name="avatar_driver" id="avatar_driver" data-togglable-settings="true"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> + <option value="">{L_NO_AVATAR}</option> <!-- BEGIN avatar_drivers --> <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 --> diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index dd2d07a837..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> @@ -38,13 +41,15 @@ <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_users_avatar.html b/phpBB/adm/style/acp_users_avatar.html index 0d06d088e8..8ad4ad710b 100644 --- a/phpBB/adm/style/acp_users_avatar.html +++ b/phpBB/adm/style/acp_users_avatar.html @@ -14,7 +14,7 @@ <dl> <dt><label>{L_AVATAR_TYPE}</label></dt> <dd><select name="avatar_driver" id="avatar_driver" data-togglable-settings="true"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> + <option value="">{L_NO_AVATAR}</option> <!-- BEGIN avatar_drivers --> <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 --> diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index f23c720add..b8f55e66c5 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -209,6 +209,9 @@ li { #page-footer { clear: both; +} + +.copyright { font-size: 0.75em; text-align: center; } @@ -317,176 +320,156 @@ 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 { +#tabs > ul: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 @@ -984,6 +967,10 @@ table.fixed-width-table { margin-bottom: 1px; } + .rtl table.responsive td { + text-align: right !important; + } + table.responsive td.empty { display: none !important; } @@ -1004,6 +991,10 @@ table.fixed-width-table { box-sizing: border-box; } + .rtl table.responsive.two-columns td { + float: right; + } + table.responsive.two-columns td:nth-child(2n+1) { clear: left; } @@ -1594,7 +1585,6 @@ input.button1:focus, input.button2:focus { z-index: 50; padding: 25px; padding: 0 25px 20px 25px; - text-align: left; } .phpbb_alert .alert_close { diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index a839e7e0e2..253fd46a62 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -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); }); diff --git a/phpBB/adm/style/auth_provider_ldap.html b/phpBB/adm/style/auth_provider_ldap.html index 9e0567dfed..97684db396 100644 --- a/phpBB/adm/style/auth_provider_ldap.html +++ b/phpBB/adm/style/auth_provider_ldap.html @@ -22,7 +22,7 @@ </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> + <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> diff --git a/phpBB/adm/style/install_footer.html b/phpBB/adm/style/install_footer.html index 75ad3c39f4..a29fce6c5a 100644 --- a/phpBB/adm/style/install_footer.html +++ b/phpBB/adm/style/install_footer.html @@ -5,7 +5,9 @@ </div> <div id="page-footer"> - Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited + <div class="copyright"> + Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited + </div> </div> </div> diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html index a8f7009e4b..c818a4fc6d 100644 --- a/phpBB/adm/style/install_header.html +++ b/phpBB/adm/style/install_header.html @@ -29,7 +29,7 @@ <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/install_update.html b/phpBB/adm/style/install_update.html index f0df138641..898233f72d 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -184,72 +184,105 @@ <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 --> + <!-- 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> - <dd class="full" style="text-align: {S_CONTENT_FLOW_BEGIN};"><strong>{up_to_date.FILENAME}</strong></dd> + <dt style="width: 60%;"><strong><!-- IF deleted.DIR_PART -->{deleted.DIR_PART}<br /><!-- ENDIF -->{deleted.FILE_PART}</strong></dt> + <dd style="margin-{S_CONTENT_FLOW_BEGIN}: 60%;"> + <!-- IF not deleted.S_BINARY -->[<a href="{deleted.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{deleted.L_SHOW_DIFF}</a>]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --> + </dd> </dl> - <!-- END up_to_date --> + <!-- END deleted --> </fieldset> <!-- ENDIF --> - <!-- IF .new --> - <h2>{L_FILES_NEW}</h2> - <p>{L_FILES_NEW_EXPLAIN}</p> + <!-- 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> - <legend><img src="{T_IMAGE_PATH}file_new.gif" alt="{L_STATUS_NEW}" /></legend> - <!-- BEGIN new --> + <!-- BEGIN conflict --> + <fieldset id="conflict"> + <legend><img src="{T_IMAGE_PATH}file_conflict.gif" alt="{L_STATUS_CONFLICT}" /></legend> <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 --> + <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> - <!-- END new --> + <!-- 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 --> - <!-- 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> + <!-- IF .new_conflict --> + <h2>{L_FILES_NEW_CONFLICT}</h2> + <div style="float: {S_CONTENT_FLOW_END};">» <a href="#" onclick="phpbb.toggleDisplay('new_conflict', 0); return false;">{L_TOGGLE_DISPLAY}</a></div> + <p>{L_FILES_NEW_CONFLICT_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 --> + <fieldset id="new_conflict"> + <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 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 --> + <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 not_modified --> + <!-- END new_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> <!-- BEGIN modified --> - <fieldset> + <fieldset id="modified"> <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> @@ -277,74 +310,65 @@ <!-- ENDIF --> - <!-- IF .new_conflict --> - <h2>{L_FILES_NEW_CONFLICT}</h2> - <p>{L_FILES_NEW_CONFLICT_EXPLAIN}</p> + <!-- 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> - <legend><img src="{T_IMAGE_PATH}file_new_conflict.gif" alt="{L_STATUS_NEW_CONFLICT}" /></legend> - <!-- BEGIN new_conflict --> + <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: 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 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_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 --> + <!-- 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_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> + <!-- 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_conflict --> + <!-- END new --> </fieldset> <!-- ENDIF --> - <!-- IF .conflict --> - <h2>{L_FILES_CONFLICT}</h2> - <p>{L_FILES_CONFLICT_EXPLAIN}</p> + <!-- 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> - <!-- BEGIN conflict --> - <fieldset> - <legend><img src="{T_IMAGE_PATH}file_conflict.gif" alt="{L_STATUS_CONFLICT}" /></legend> + <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 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 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 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> + <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> - <!-- 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 --> + <!-- END not_modified --> + </fieldset> + + <!-- ENDIF --> + + <!-- IF .up_to_date --> + <h2>{L_FILES_UP_TO_DATE}</h2> + <div style="float: {S_CONTENT_FLOW_END};">» <a href="#" onclick="phpbb.toggleDisplay('up_to_date', 0); return false;">{L_TOGGLE_DISPLAY}</a></div> + <p>{L_FILES_UP_TO_DATE_EXPLAIN}</p> + + <fieldset id="up_to_date" style="display: none;"> + <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> - <!-- END conflict --> <!-- ENDIF --> diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index 0f4589f5d4..deb38c8691 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> diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index 25a82a5faa..f1f7eee282 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -89,6 +89,8 @@ function popup(url, width, height, name) {$STYLESHEETS} +<!-- EVENT acp_overall_header_stylesheets_after --> + </head> <body class="{S_CONTENT_DIRECTION} {BODY_CLASS} nojs"> @@ -106,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/simple_header.html b/phpBB/adm/style/simple_header.html index bf8f41cd7a..d0b9bf62ed 100644 --- a/phpBB/adm/style/simple_header.html +++ b/phpBB/adm/style/simple_header.html @@ -84,6 +84,7 @@ 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}"> diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 37728864c4..388f31698f 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -7,6 +7,7 @@ phpbb.alertTime = 100; // define a couple constants for keydown functions. var keymap = { + TAB: 9, ENTER: 13, ESC: 27 }; @@ -47,6 +48,18 @@ phpbb.clearLoadingTimeout = function() { } }; + +/** +* Close popup alert after a specified delay +* +* @param int 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(). * @@ -271,7 +284,7 @@ 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(); @@ -873,19 +886,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 = {}; /** @@ -1201,10 +1201,10 @@ phpbb.applyCodeEditor = function(textarea) { var key = event.keyCode || event.which; // intercept tabs - if (key == 9 && - !event.ctrlKey && - !event.shiftKey && - !event.altKey && + if (key == keymap.TAB && + !event.ctrlKey && + !event.shiftKey && + !event.altKey && !event.metaKey) { if (inTag()) { appendText("\t"); @@ -1214,7 +1214,7 @@ phpbb.applyCodeEditor = function(textarea) { } // intercept new line characters - if (key == 13) { + if (key == keymap.ENTER) { if (inTag()) { var lastLine = getLastLine(true), code = '' + /^\s*/g.exec(lastLine); @@ -1308,11 +1308,29 @@ phpbb.toggleDropdown = function() { 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()); + $(this).css({marginLeft: 0, left: 0}); + }); + + var maxOffset = Math.min(contentWidth, fullFreeSpace) + 'px'; + options.dropdown.css({'width': maxOffset, 'margin-left': '-' + maxOffset}); + } } else { options.dropdown.css('margin-right', '-' + (windowWidth + freeSpace) + 'px'); } @@ -1515,11 +1533,37 @@ phpbb.getFunctionByName = function (functionName) { }; /** -* Apply code editor to all textarea elements with data-bbcode attribute +* Register page dropdowns. */ -$(document).ready(function() { - $('textarea[data-bbcode]').each(function() { - phpbb.applyCodeEditor(this); +phpbb.registerPageDropdowns = function() { + $('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 @@ -1529,6 +1573,17 @@ $(document).ready(function() { $(phpbb.dropdownHandles).each(phpbb.toggleDropdown); } }); +} + +/** +* Apply code editor to all textarea elements with data-bbcode attribute +*/ +$(document).ready(function() { + $('textarea[data-bbcode]').each(function() { + phpbb.applyCodeEditor(this); + }); + + phpbb.registerPageDropdowns(); $('#color_palette_placeholder').each(function() { phpbb.registerPalette($(this)); diff --git a/phpBB/bin/phpbbcli.php b/phpBB/bin/phpbbcli.php index 8b8d8e43fd..ca425ad0c4 100755 --- a/phpBB/bin/phpbbcli.php +++ b/phpBB/bin/phpbbcli.php @@ -12,6 +12,8 @@ * */ +use Symfony\Component\Console\Input\ArgvInput; + if (php_sapi_name() != 'cli') { echo 'This program must be run from the command line.' . PHP_EOL; @@ -22,26 +24,44 @@ 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 . '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()); + 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/functions_container.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $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_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); +$phpbb_container_builder->set_dump_container(false); + +$input = new ArgvInput(); + +if ($input->hasParameterOption(array('--safe-mode'))) +{ + $phpbb_container_builder->set_use_extensions(false); + $phpbb_container_builder->set_dump_container(false); +} +else +{ + $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); + $phpbb_class_loader_ext->register(); + phpbb_load_extensions_autoloaders($phpbb_root_path); +} -$phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, "$phpbb_root_path/config"); +$phpbb_container = $phpbb_container_builder->get_container(); $phpbb_container->get('request')->enable_super_globals(); require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx); $user = $phpbb_container->get('user'); $user->add_lang('acp/common'); +$user->add_lang('cli'); $application = new \phpbb\console\application('phpBB Console', PHPBB_VERSION, $user); -$application->register_container_commands($phpbb_container); -$application->run(); +$application->register_container_commands($phpbb_container->get('console.command_collection')); +$application->run($input); diff --git a/phpBB/common.php b/phpBB/common.php index 4b06cd1eda..f6586c40fe 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -21,11 +21,13 @@ if (!defined('IN_PHPBB')) } require($phpbb_root_path . 'includes/startup.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); -if (file_exists($phpbb_root_path . 'config.' . $phpEx)) -{ - require($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_INSTALLED')) { @@ -76,11 +78,8 @@ $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); @@ -89,14 +88,14 @@ 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(); $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); +phpbb_load_extensions_autoloaders($phpbb_root_path); + // Set up container -$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); +$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); +$phpbb_container = $phpbb_container_builder->get_container(); $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); diff --git a/phpBB/composer.json b/phpBB/composer.json index 435d6139e4..0ab30b0837 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -1,9 +1,31 @@ { - "_readme": [ - "You MUST update the clean-vendor-dir target in build/build.xml", - "accordingly when adding or upgrading dependencies." + "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": { + "php": ">=5.3.3", "lusitanian/oauth": "0.2.*", "symfony/config": "2.3.*", "symfony/console": "2.3.*", @@ -15,11 +37,20 @@ "twig/twig": "1.13.*" }, "require-dev": { + "behat/mink": "1.4.*", + "behat/mink-goutte-driver": "1.0.*", "fabpot/goutte": "1.0.*", "phpunit/dbunit": "1.3.*", "phpunit/phpunit": "4.1.*", "phing/phing": "2.4.*", "sami/sami": "1.*", - "squizlabs/php_codesniffer": "1.*" + "squizlabs/php_codesniffer": "1.*", + "symfony/browser-kit": "2.3.*", + "symfony/debug": "2.3.*", + "symfony/dom-crawler": "2.3.*", + "symfony/filesystem": "2.3.*", + "symfony/finder": "2.3.*", + "symfony/http-foundation": "2.3.*", + "symfony/process": "2.3.*" } } diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 2213c3789b..3860a98b31 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -3,7 +3,7 @@ "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": "be323c0a1b5baeb83934238033e079ec", + "hash": "6bc742a2b9feb426db9987d27085f915", "packages": [ { "name": "lusitanian/oauth", @@ -108,17 +108,17 @@ }, { "name": "symfony/config", - "version": "v2.3.12", + "version": "v2.3.16", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "91faa2d4944d0c8a94d5b73cb7ccfb219aee9d21" + "reference": "259722b5f2e87d3f487630abfd40f922cf2f6900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/91faa2d4944d0c8a94d5b73cb7ccfb219aee9d21", - "reference": "91faa2d4944d0c8a94d5b73cb7ccfb219aee9d21", + "url": "https://api.github.com/repos/symfony/Config/zipball/259722b5f2e87d3f487630abfd40f922cf2f6900", + "reference": "259722b5f2e87d3f487630abfd40f922cf2f6900", "shasum": "" }, "require": { @@ -154,21 +154,21 @@ ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2014-03-31 10:15:50" + "time": "2014-04-22 08:09:28" }, { "name": "symfony/console", - "version": "v2.3.12", + "version": "v2.3.16", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "df17996d37eb113a5675ca4cc2ac45f4fc057cb7" + "reference": "c6c5a354a9945a5e9a9a6a495ca19558eb8639e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/df17996d37eb113a5675ca4cc2ac45f4fc057cb7", - "reference": "df17996d37eb113a5675ca4cc2ac45f4fc057cb7", + "url": "https://api.github.com/repos/symfony/Console/zipball/c6c5a354a9945a5e9a9a6a495ca19558eb8639e9", + "reference": "c6c5a354a9945a5e9a9a6a495ca19558eb8639e9", "shasum": "" }, "require": { @@ -209,21 +209,21 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2014-03-01 17:25:29" + "time": "2014-05-14 13:35:53" }, { "name": "symfony/debug", - "version": "v2.4.4", + "version": "v2.3.16", "target-dir": "Symfony/Component/Debug", "source": { "type": "git", "url": "https://github.com/symfony/Debug.git", - "reference": "6a8eb9aba50595014fef52d6b4d99b31dfaa6f02" + "reference": "ca764f8af9cc4ba5d81b598c1b18b30db5508e18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Debug/zipball/6a8eb9aba50595014fef52d6b4d99b31dfaa6f02", - "reference": "6a8eb9aba50595014fef52d6b4d99b31dfaa6f02", + "url": "https://api.github.com/repos/symfony/Debug/zipball/ca764f8af9cc4ba5d81b598c1b18b30db5508e18", + "reference": "ca764f8af9cc4ba5d81b598c1b18b30db5508e18", "shasum": "" }, "require": { @@ -234,13 +234,14 @@ "symfony/http-kernel": "~2.1" }, "suggest": { + "symfony/class-loader": "", "symfony/http-foundation": "", "symfony/http-kernel": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -254,33 +255,31 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Debug Component", "homepage": "http://symfony.com", - "time": "2014-04-16 10:34:42" + "time": "2014-04-29 19:42:43" }, { "name": "symfony/dependency-injection", - "version": "v2.3.12", + "version": "v2.3.16", "target-dir": "Symfony/Component/DependencyInjection", "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "41e9e2078e8edf261c11be478300c8fcddb64e30" + "reference": "5ebd813eac59b4051705a2e29e32f211a966b6ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/41e9e2078e8edf261c11be478300c8fcddb64e30", - "reference": "41e9e2078e8edf261c11be478300c8fcddb64e30", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/5ebd813eac59b4051705a2e29e32f211a966b6ca", + "reference": "5ebd813eac59b4051705a2e29e32f211a966b6ca", "shasum": "" }, "require": { @@ -324,21 +323,21 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "http://symfony.com", - "time": "2014-03-27 18:14:33" + "time": "2014-05-02 22:42:57" }, { "name": "symfony/event-dispatcher", - "version": "v2.3.12", + "version": "v2.3.16", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "15645237c6ff70e74a28e8836362d82492765055" + "reference": "cb7cd38c081507d10997553c4c522956a4d2afab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/15645237c6ff70e74a28e8836362d82492765055", - "reference": "15645237c6ff70e74a28e8836362d82492765055", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/cb7cd38c081507d10997553c4c522956a4d2afab", + "reference": "cb7cd38c081507d10997553c4c522956a4d2afab", "shasum": "" }, "require": { @@ -380,21 +379,21 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2014-02-11 10:29:24" + "time": "2014-04-16 10:30:19" }, { "name": "symfony/filesystem", - "version": "v2.4.4", + "version": "v2.3.16", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "a3af8294bcce4a7c1b2892363b0c9d8109affad4" + "reference": "69e476c4db31c43ab7ab797adc5fc73d20aa5571" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a3af8294bcce4a7c1b2892363b0c9d8109affad4", - "reference": "a3af8294bcce4a7c1b2892363b0c9d8109affad4", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/69e476c4db31c43ab7ab797adc5fc73d20aa5571", + "reference": "69e476c4db31c43ab7ab797adc5fc73d20aa5571", "shasum": "" }, "require": { @@ -403,7 +402,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -429,33 +428,30 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2014-04-16 10:34:31" + "time": "2014-04-16 10:30:19" }, { "name": "symfony/http-foundation", - "version": "v2.4.4", + "version": "v2.3.16", "target-dir": "Symfony/Component/HttpFoundation", "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation.git", - "reference": "22c4dee84271ad0cd08d19f26d89f2878e11159b" + "reference": "ad7891d4dfe221c5a9edca64b71bdb500f5b026a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/22c4dee84271ad0cd08d19f26d89f2878e11159b", - "reference": "22c4dee84271ad0cd08d19f26d89f2878e11159b", + "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/ad7891d4dfe221c5a9edca64b71bdb500f5b026a", + "reference": "ad7891d4dfe221c5a9edca64b71bdb500f5b026a", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "require-dev": { - "symfony/expression-language": "~2.4" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -484,21 +480,21 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "http://symfony.com", - "time": "2014-04-18 21:02:05" + "time": "2014-05-22 16:20:26" }, { "name": "symfony/http-kernel", - "version": "v2.3.12", + "version": "v2.3.16", "target-dir": "Symfony/Component/HttpKernel", "source": { "type": "git", "url": "https://github.com/symfony/HttpKernel.git", - "reference": "48d61b3622ca35dd924b167441a9810ad55906ce" + "reference": "d8c00747f592183692afaacf622c444c36092613" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/48d61b3622ca35dd924b167441a9810ad55906ce", - "reference": "48d61b3622ca35dd924b167441a9810ad55906ce", + "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/d8c00747f592183692afaacf622c444c36092613", + "reference": "d8c00747f592183692afaacf622c444c36092613", "shasum": "" }, "require": { @@ -557,21 +553,21 @@ ], "description": "Symfony HttpKernel Component", "homepage": "http://symfony.com", - "time": "2014-04-03 05:42:39" + "time": "2014-05-31 02:04:21" }, { "name": "symfony/routing", - "version": "v2.3.12", + "version": "v2.3.16", "target-dir": "Symfony/Component/Routing", "source": { "type": "git", "url": "https://github.com/symfony/Routing.git", - "reference": "08afcafd9af22a24a8055669f85d63b863c4711b" + "reference": "6e4c9024a04340b83e456a1a24597dba066dcdc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/08afcafd9af22a24a8055669f85d63b863c4711b", - "reference": "08afcafd9af22a24a8055669f85d63b863c4711b", + "url": "https://api.github.com/repos/symfony/Routing/zipball/6e4c9024a04340b83e456a1a24597dba066dcdc9", + "reference": "6e4c9024a04340b83e456a1a24597dba066dcdc9", "shasum": "" }, "require": { @@ -617,21 +613,21 @@ ], "description": "Symfony Routing Component", "homepage": "http://symfony.com", - "time": "2014-03-28 10:34:27" + "time": "2014-04-23 13:35:47" }, { "name": "symfony/yaml", - "version": "v2.3.12", + "version": "v2.3.16", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "3acf34f6993db3d873fa77ac2cb6e595db00b88d" + "reference": "2e257c292cfce88bf6c894a03d0fe8d782055aee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/3acf34f6993db3d873fa77ac2cb6e595db00b88d", - "reference": "3acf34f6993db3d873fa77ac2cb6e595db00b88d", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/2e257c292cfce88bf6c894a03d0fe8d782055aee", + "reference": "2e257c292cfce88bf6c894a03d0fe8d782055aee", "shasum": "" }, "require": { @@ -666,7 +662,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-03-04 16:04:39" + "time": "2014-05-12 09:13:35" }, { "name": "twig/twig", @@ -723,6 +719,167 @@ ], "packages-dev": [ { + "name": "behat/mink", + "version": "v1.4.3", + "source": { + "type": "git", + "url": "https://github.com/Behat/Mink.git", + "reference": "0817070a6e2ec9f475fad9bfb81a962c462eb934" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/Mink/zipball/0817070a6e2ec9f475fad9bfb81a962c462eb934", + "reference": "0817070a6e2ec9f475fad9bfb81a962c462eb934", + "shasum": "" + }, + "require": { + "php": ">=5.3.1", + "symfony/css-selector": ">=2.0,<2.4-dev" + }, + "suggest": { + "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", + "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", + "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", + "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Web acceptance testing framework for PHP 5.3", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "testing", + "web" + ], + "time": "2013-03-02 15:53:18" + }, + { + "name": "behat/mink-browserkit-driver", + "version": "v1.0.5", + "source": { + "type": "git", + "url": "https://github.com/Behat/MinkBrowserKitDriver.git", + "reference": "f2771b5fc4dbc233859addf37a7d150852f78418" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/MinkBrowserKitDriver/zipball/f2771b5fc4dbc233859addf37a7d150852f78418", + "reference": "f2771b5fc4dbc233859addf37a7d150852f78418", + "shasum": "" + }, + "require": { + "behat/mink": "~1.4.3", + "php": ">=5.3.1", + "symfony/browser-kit": "~2.0", + "symfony/dom-crawler": "~2.0" + }, + "require-dev": { + "silex/silex": "@dev" + }, + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink\\Driver": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Symfony2 BrowserKit driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "Mink", + "Symfony2", + "browser", + "testing" + ], + "time": "2013-04-13 12:17:15" + }, + { + "name": "behat/mink-goutte-driver", + "version": "v1.0.9", + "source": { + "type": "git", + "url": "https://github.com/Behat/MinkGoutteDriver.git", + "reference": "fa1b073b48761464feb0b05e6825da44b20118d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/MinkGoutteDriver/zipball/fa1b073b48761464feb0b05e6825da44b20118d8", + "reference": "fa1b073b48761464feb0b05e6825da44b20118d8", + "shasum": "" + }, + "require": { + "behat/mink-browserkit-driver": ">=1.0.5,<1.2.0", + "fabpot/goutte": "~1.0.1", + "php": ">=5.3.1" + }, + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink\\Driver": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Goutte driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "goutte", + "headless", + "testing" + ], + "time": "2013-07-03 18:43:54" + }, + { "name": "fabpot/goutte", "version": "v1.0.3", "source": { @@ -2009,17 +2166,17 @@ }, { "name": "symfony/browser-kit", - "version": "v2.3.4", + "version": "v2.3.16", "target-dir": "Symfony/Component/BrowserKit", "source": { "type": "git", "url": "https://github.com/symfony/BrowserKit.git", - "reference": "2639dc4eec81f92760e05396a93bb78000b4f5ca" + "reference": "bc6cb0fe5196ecfe183483791928ed525ac41728" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/2639dc4eec81f92760e05396a93bb78000b4f5ca", - "reference": "2639dc4eec81f92760e05396a93bb78000b4f5ca", + "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/bc6cb0fe5196ecfe183483791928ed525ac41728", + "reference": "bc6cb0fe5196ecfe183483791928ed525ac41728", "shasum": "" }, "require": { @@ -2062,21 +2219,21 @@ ], "description": "Symfony BrowserKit Component", "homepage": "http://symfony.com", - "time": "2013-07-21 12:12:18" + "time": "2014-04-22 14:58:51" }, { "name": "symfony/css-selector", - "version": "v2.3.4", + "version": "v2.3.16", "target-dir": "Symfony/Component/CssSelector", "source": { "type": "git", "url": "https://github.com/symfony/CssSelector.git", - "reference": "885544201cb24e79754da1dbd61bd779c2e4353e" + "reference": "2ff53e8a7870b453836e879b083b971d455e174d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/CssSelector/zipball/885544201cb24e79754da1dbd61bd779c2e4353e", - "reference": "885544201cb24e79754da1dbd61bd779c2e4353e", + "url": "https://api.github.com/repos/symfony/CssSelector/zipball/2ff53e8a7870b453836e879b083b971d455e174d", + "reference": "2ff53e8a7870b453836e879b083b971d455e174d", "shasum": "" }, "require": { @@ -2115,21 +2272,21 @@ ], "description": "Symfony CssSelector Component", "homepage": "http://symfony.com", - "time": "2013-07-21 12:12:18" + "time": "2014-05-12 09:13:35" }, { "name": "symfony/dom-crawler", - "version": "v2.3.4", + "version": "v2.3.16", "target-dir": "Symfony/Component/DomCrawler", "source": { "type": "git", "url": "https://github.com/symfony/DomCrawler.git", - "reference": "e05e07fe8958a304b5e135f8e65d4ae6148cf59b" + "reference": "5dd259d7842480fa7c5d4a45c4f911bd6fb60bc8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/e05e07fe8958a304b5e135f8e65d4ae6148cf59b", - "reference": "e05e07fe8958a304b5e135f8e65d4ae6148cf59b", + "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/5dd259d7842480fa7c5d4a45c4f911bd6fb60bc8", + "reference": "5dd259d7842480fa7c5d4a45c4f911bd6fb60bc8", "shasum": "" }, "require": { @@ -2170,21 +2327,21 @@ ], "description": "Symfony DomCrawler Component", "homepage": "http://symfony.com", - "time": "2013-07-21 12:12:18" + "time": "2014-05-26 22:15:18" }, { "name": "symfony/finder", - "version": "v2.3.4", + "version": "v2.3.16", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1" + "reference": "32949721cc76afd75e4ac60d14ac3cf55b10a768" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1", - "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1", + "url": "https://api.github.com/repos/symfony/Finder/zipball/32949721cc76afd75e4ac60d14ac3cf55b10a768", + "reference": "32949721cc76afd75e4ac60d14ac3cf55b10a768", "shasum": "" }, "require": { @@ -2219,21 +2376,21 @@ ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2013-08-13 20:18:00" + "time": "2014-05-22 13:42:36" }, { "name": "symfony/process", - "version": "v2.3.4", + "version": "v2.3.16", "target-dir": "Symfony/Component/Process", "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b" + "reference": "2cd7d075df6cb0d564c069a66408b3877c07d4e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", - "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", + "url": "https://api.github.com/repos/symfony/Process/zipball/2cd7d075df6cb0d564c069a66408b3877c07d4e3", + "reference": "2cd7d075df6cb0d564c069a66408b3877c07d4e3", "shasum": "" }, "require": { @@ -2268,20 +2425,14 @@ ], "description": "Symfony Process Component", "homepage": "http://symfony.com", - "time": "2013-08-22 06:42:25" + "time": "2014-05-17 21:49:26" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": [ - - ], - "platform": [ - - ], - "platform-dev": [ - - ] + "stability-flags": [], + "platform": { + "php": ">=5.3.3" + }, + "platform-dev": [] } diff --git a/phpBB/config/avatars.yml b/phpBB/config/avatars.yml index d22a5db2ae..8e5b1fdbfe 100644 --- a/phpBB/config/avatars.yml +++ b/phpBB/config/avatars.yml @@ -45,6 +45,7 @@ services: - %core.root_path% - %core.php_ext% - @path_helper + - @mimetype.guesser - @cache.driver calls: - [set_name, [avatar.driver.upload]] diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml index 00b8f9cec0..540908164a 100644 --- a/phpBB/config/console.yml +++ b/phpBB/config/console.yml @@ -1,12 +1,19 @@ services: + 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 - - @user - @config tags: - { name: console.command } @@ -14,6 +21,7 @@ services: console.command.config.delete: class: phpbb\console\command\config\delete arguments: + - @user - @config tags: - { name: console.command } @@ -21,6 +29,7 @@ services: console.command.config.increment: class: phpbb\console\command\config\increment arguments: + - @user - @config tags: - { name: console.command } @@ -28,6 +37,7 @@ services: console.command.config.get: class: phpbb\console\command\config\get arguments: + - @user - @config tags: - { name: console.command } @@ -35,6 +45,7 @@ services: console.command.config.set: class: phpbb\console\command\config\set arguments: + - @user - @config tags: - { name: console.command } @@ -42,6 +53,7 @@ services: console.command.config.set_atomic: class: phpbb\console\command\config\set_atomic arguments: + - @user - @config tags: - { name: console.command } @@ -49,35 +61,36 @@ services: console.command.cron.list: class: phpbb\console\command\cron\cron_list arguments: - - @cron.manager - @user + - @cron.manager tags: - { name: console.command } console.command.cron.run: class: phpbb\console\command\cron\run arguments: + - @user - @cron.manager - @cron.lock_db - - @user tags: - { name: console.command } console.command.db.migrate: class: phpbb\console\command\db\migrate arguments: + - @user - @migrator - @ext.manager - @config - @cache - @log - - @user tags: - { name: console.command } console.command.dev.migration_tips: class: phpbb\console\command\dev\migration_tips arguments: + - @user - @ext.manager tags: - { name: console.command } @@ -85,6 +98,7 @@ services: console.command.extension.disable: class: phpbb\console\command\extension\disable arguments: + - @user - @ext.manager - @log tags: @@ -93,6 +107,7 @@ services: console.command.extension.enable: class: phpbb\console\command\extension\enable arguments: + - @user - @ext.manager - @log tags: @@ -101,6 +116,7 @@ services: console.command.extension.purge: class: phpbb\console\command\extension\purge arguments: + - @user - @ext.manager - @log tags: @@ -109,6 +125,7 @@ services: console.command.extension.show: class: phpbb\console\command\extension\show arguments: + - @user - @ext.manager - @log tags: @@ -117,6 +134,7 @@ services: console.command.fixup.recalculate_email_hash: class: phpbb\console\command\fixup\recalculate_email_hash arguments: + - @user - @dbal.conn tags: - { name: console.command } diff --git a/phpBB/config/migrator.yml b/phpBB/config/migrator.yml index 202421c09f..cd04eea5c2 100644 --- a/phpBB/config/migrator.yml +++ b/phpBB/config/migrator.yml @@ -29,6 +29,13 @@ services: 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: diff --git a/phpBB/config/profilefields.yml b/phpBB/config/profilefields.yml index 00f025e141..ce2a84b12b 100644 --- a/phpBB/config/profilefields.yml +++ b/phpBB/config/profilefields.yml @@ -55,6 +55,15 @@ services: 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: diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 2b3de099bd..a9f9f5ed19 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -39,9 +39,6 @@ services: cache.driver: class: %cache.driver.class% - cache.driver.install: - class: phpbb\cache\driver\file - class_loader: class: phpbb\class_loader arguments: @@ -69,6 +66,9 @@ services: - @cache.driver - %tables.config% + config.php: + synthetic: true + config_text: class: phpbb\config\db_text arguments: @@ -97,6 +97,7 @@ services: - @config - @controller.provider - @ext.manager + - @symfony_request - %core.root_path% - %core.php_ext% @@ -140,6 +141,11 @@ services: - @service_container 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%]] @@ -256,7 +262,6 @@ services: arguments: - @auth - @config - - @config_text - @dbal.conn - @user - %core.root_path% @@ -301,6 +306,7 @@ services: arguments: - @symfony_request - @filesystem + - @request - %core.root_path% - %core.php_ext% - %core.adm_relative_path% @@ -356,3 +362,8 @@ services: - @cache - @config - @user + + viewonline_helper: + class: phpbb\viewonline_helper + arguments: + - @filesystem diff --git a/phpBB/cron.php b/phpBB/cron.php index 8bb49bd5d2..3f022b1db8 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -62,8 +62,9 @@ if ($cron_lock->acquire()) if ($task->is_ready()) { $task->run(); - garbage_collection(); } } $cron_lock->release(); } + +garbage_collection(); diff --git a/phpBB/develop/add_permissions.php b/phpBB/develop/add_permissions.php index 7639256cfd..fd419a7dde 100644 --- a/phpBB/develop/add_permissions.php +++ b/phpBB/develop/add_permissions.php @@ -371,7 +371,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': diff --git a/phpBB/develop/benchmark.php b/phpBB/develop/benchmark.php index 27176c97d3..c3cf90773e 100644 --- a/phpBB/develop/benchmark.php +++ b/phpBB/develop/benchmark.php @@ -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"; diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 05085d39ab..b1e981795f 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -20,7 +20,6 @@ $schema_path = dirname(__FILE__) . '/../install/schemas/'; $supported_dbms = array( - 'firebird', 'mssql', 'mysql_40', 'mysql_41', @@ -58,188 +57,4 @@ $fp = fopen($schema_path . 'schema.json', 'wb'); fwrite($fp, json_encode($schema_data, JSON_PRETTY_PRINT)); fclose($fp); -foreach ($supported_dbms as $dbms) -{ - $fp = fopen($schema_path . $dbms . '_schema.sql', 'wb'); - - // Write Header - switch ($dbms) - { - case 'mysql_40': - case 'mysql_41': - case 'firebird': - case 'sqlite': - case 'sqlite3': - 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; - } - - $line = ''; - switch ($dbms) - { - case 'oracle': - $line .= custom_data('oracle') . "\n"; - break; - - case 'postgres': - $line .= "BEGIN;\n\n"; - $line .= custom_data('postgres') . "\n"; - $line .= "COMMIT;\n\n"; - 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 ''; -} - echo 'done'; diff --git a/phpBB/develop/merge_attachment_tables.php b/phpBB/develop/merge_attachment_tables.php index a23db829e5..dd6e12172e 100644 --- a/phpBB/develop/merge_attachment_tables.php +++ b/phpBB/develop/merge_attachment_tables.php @@ -48,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 700c509782..9e81917108 100644 --- a/phpBB/develop/merge_post_tables.php +++ b/phpBB/develop/merge_post_tables.php @@ -46,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': @@ -142,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/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ab3a42206e..71971108b1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -46,6 +46,8 @@ <ol> <li><a href="#changelog">Changelog</a> <ol style="list-style-type: lower-roman;"> + <li><a href="#v310b3">Changes since 3.1.0-RC1</a></li> + <li><a href="#v310b3">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> @@ -93,7 +95,198 @@ <div class="content"> - <a name="v310b3"></a><h3>1.i. Changes since 3.1.0-b3</h3> + <a name="v310RC1"></a><h3>1.i. 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>1.ii. 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>1.iii. Changes since 3.1.0-b3</h3> <h4>Bug</h4> <ul> @@ -200,7 +393,7 @@ </ul> - <a name="v310b2"></a><h3>1.ii. Changes since 3.1.0-b2</h3> + <a name="v310b2"></a><h3>1.iv. Changes since 3.1.0-b2</h3> <h4>Bug</h4> <ul> @@ -365,7 +558,7 @@ </ul> - <a name="v310b1"></a><h3>1.iii. Changes since 3.1.0-b1</h3> + <a name="v310b1"></a><h3>1.v. Changes since 3.1.0-b1</h3> <h4>Bug</h4> <ul> @@ -433,7 +626,7 @@ <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>1.iv. Changes since 3.1.0-a3</h3> + <a name="v310a3"></a><h3>1.vi. Changes since 3.1.0-a3</h3> <h4>Bug</h4> <ul> @@ -580,7 +773,7 @@ </ul> - <a name="v310a2"></a><h3>1.v. Changes since 3.1.0-a2</h3> + <a name="v310a2"></a><h3>1.vii. Changes since 3.1.0-a2</h3> <h4>Bug</h4> <ul> @@ -688,7 +881,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.vi. Changes since 3.1.0-a1</h3> + <a name="v310a1"></a><h3>1.viii. Changes since 3.1.0-a1</h3> <h4>Bug</h4> <ul> @@ -764,7 +957,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.vii. Changes since 3.0.x</h3> + <a name="v30x"></a><h3>1.ix. Changes since 3.0.x</h3> <h4>Bug</h4> <ul> @@ -1445,7 +1638,7 @@ <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.viii. Changes since 3.0.11</h3> + <a name="v3011"></a><h3>1.x. Changes since 3.0.11</h3> <h4>Bug</h4> <ul> @@ -1600,7 +1793,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.ix. Changes since 3.0.10</h3> + <a name="v3010"></a><h3>1.xi. Changes since 3.0.10</h3> <h4>Bug</h4> <ul> @@ -1725,7 +1918,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.x. Changes since 3.0.9</h3> + <a name="v309"></a><h3>1.xii. Changes since 3.0.9</h3> <h4>Bug</h4> <ul> @@ -1861,7 +2054,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.xi. Changes since 3.0.8</h3> + <a name="v308"></a><h3>1.xiii. Changes since 3.0.8</h3> <h4> Bug </h4> @@ -2229,7 +2422,7 @@ </ul> - <a name="v307-PL1"></a><h3>1.xii. Changes since 3.0.7-PL1</h3> + <a name="v307-PL1"></a><h3>1.xiv. Changes since 3.0.7-PL1</h3> <h4> Security </h4> <ul> @@ -2687,13 +2880,13 @@ </ul> - <a name="v307"></a><h3>1.xiii. Changes since 3.0.7</h3> + <a name="v307"></a><h3>1.xv. 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.xiv. Changes since 3.0.6</h3> + <a name="v306"></a><h3>1.xvi. 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> @@ -2797,7 +2990,7 @@ </ul> - <a name="v305"></a><h3>1.xv. Changes since 3.0.5</h3> + <a name="v305"></a><h3>1.xvii. Changes since 3.0.5</h3> <ul> <li>[Fix] Allow whitespaces in avatar gallery names. (Bug #44955)</li> @@ -3019,7 +3212,7 @@ <li>[Feature] Send anonymous statistical information to phpBB on installation and update (optional).</li> </ul> - <a name="v304"></a><h3>1.xvi. Changes since 3.0.4</h3> + <a name="v304"></a><h3>1.xviii. 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> @@ -3108,7 +3301,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.xvii. Changes since 3.0.3</h3> + <a name="v303"></a><h3>1.xix. Changes since 3.0.3</h3> <ul> <li>[Fix] Allow mixed-case template directories to be inherited (Bug #36725)</li> @@ -3140,7 +3333,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.xviii. Changes since 3.0.2</h3> + <a name="v302"></a><h3>1.xx. 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> @@ -3239,7 +3432,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.xix. Changes since 3.0.1</h3> + <a name="v301"></a><h3>1.xxi. Changes since 3.0.1</h3> <ul> <li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li> @@ -3287,7 +3480,7 @@ <li>[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)</li> </ul> - <a name="v300"></a><h3>1.xx. Changes since 3.0.0</h3> + <a name="v300"></a><h3>1.xxii. Changes since 3.0.0</h3> <ul> <li>[Change] Validate birthdays (Bug #15004)</li> @@ -3358,7 +3551,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.xxi. Changes since 3.0.RC8</h3> + <a name="v30rc8"></a><h3>1.xxiii. 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> @@ -3367,7 +3560,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.xxii. Changes since 3.0.RC7</h3> + <a name="v30rc7"></a><h3>1.xxiv. Changes since 3.0.RC7</h3> <ul> <li>[Fix] Fixed MSSQL related bug in the update system</li> @@ -3402,7 +3595,7 @@ <li>[Fix] No duplication of active topics (Bug #15474)</li> </ul> - <a name="v30rc6"></a><h3>1.xxiii. Changes since 3.0.RC6</h3> + <a name="v30rc6"></a><h3>1.xxv. Changes since 3.0.RC6</h3> <ul> <li>[Fix] Submitting language changes using acp_language (Bug #14736)</li> @@ -3412,7 +3605,7 @@ <li>[Fix] Able to request new password (Bug #14743)</li> </ul> - <a name="v30rc5"></a><h3>1.xxiv. Changes since 3.0.RC5</h3> + <a name="v30rc5"></a><h3>1.xxvi. 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> @@ -3475,7 +3668,7 @@ <li>[Sec] New password hashing mechanism for storing passwords (#i42)</li> </ul> - <a name="v30rc4"></a><h3>1.xxv. Changes since 3.0.RC4</h3> + <a name="v30rc4"></a><h3>1.xxvii. Changes since 3.0.RC4</h3> <ul> <li>[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)</li> @@ -3526,7 +3719,7 @@ <li>[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)</li> </ul> - <a name="v30rc3"></a><h3>1.xxvi. Changes since 3.0.RC3</h3> + <a name="v30rc3"></a><h3>1.xxviii. Changes since 3.0.RC3</h3> <ul> <li>[Fix] Fixing some subsilver2 and prosilver style issues</li> @@ -3635,7 +3828,7 @@ </ul> - <a name="v30rc2"></a><h3>1.xxvii. Changes since 3.0.RC2</h3> + <a name="v30rc2"></a><h3>1.xxix. Changes since 3.0.RC2</h3> <ul> <li>[Fix] Re-allow searching within the memberlist</li> @@ -3681,7 +3874,7 @@ </ul> - <a name="v30rc1"></a><h3>1.xxviii. Changes since 3.0.RC1</h3> + <a name="v30rc1"></a><h3>1.xxx. Changes since 3.0.RC1</h3> <ul> <li>[Fix] (X)HTML issues within the templates (Bug #11255, #11255)</li> diff --git a/phpBB/docs/CREDITS.txt b/phpBB/docs/CREDITS.txt index a4ba4cb87c..c0b1d4dbe2 100644 --- a/phpBB/docs/CREDITS.txt +++ b/phpBB/docs/CREDITS.txt @@ -25,9 +25,9 @@ phpBB Lead Developer: naderman (Nils Adermann) phpBB Developers: bantu (Andreas Fischer) dhruv.goel92 (Dhruv Goel) EXreaction (Nathan Guse) - imkingdavid (David King) marc1706 (Marc Alexander) nickvergessen (Joas Schilling) + nicofuma (Tristan Darricau) prototech (Cesar Gallegos) For a list of phpBB Team members, please see: @@ -55,6 +55,7 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010] dhn (Dominik Dröscher) [05/2007 - 01/2011] 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] diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 0fce349974..e3e12a3176 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -61,6 +61,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> @@ -136,7 +137,6 @@ <li>PostgreSQL 8.3+</li> <li>SQLite 2.8.2+</li> <li>SQLite 3.6.15+</li> - <li>Firebird 2.1+</li> <li>MS SQL Server 2000 or above (directly or via ODBC or the native adapter)</li> <li>Oracle</li> </ul> @@ -325,7 +325,41 @@ <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.</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"><span class="corners-top"><span></span></span> @@ -388,7 +422,7 @@ <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> @@ -426,7 +460,7 @@ <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> @@ -442,7 +476,7 @@ <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> diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index b0fd86f959..e64d3dd8f2 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -323,7 +323,7 @@ <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>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.3.x to 5.4.x without problem.</p> <a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3> diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 173c7e5441..98cfe0e717 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -736,7 +736,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> diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 44a7824901..044596073c 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -64,6 +64,13 @@ acp_overall_header_head_append * 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_posting_buttons_after === * Locations: @@ -78,6 +85,50 @@ acp_posting_buttons_before * Since: 3.1.0-b4 * Purpose: Add content before BBCode posting buttons in the ACP +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_simple_footer_after === * Location: adm/style/simple_footer.html @@ -96,6 +147,13 @@ acp_simple_header_head_append * 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_overview.html @@ -246,21 +304,21 @@ index_body_block_stats_prepend * Since: 3.1.0-b3 * Purpose: Prepend content to the statistics list on the Board index -index_body_linklist_after +index_body_markforums_after === * 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-RC2 +* Purpose: Add content after the mark-read link above the forum list on Board index -index_body_linklist_before +index_body_markforums_before === * 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-RC2 +* Purpose: Add content before the mark-read link above the forum list on Board index index_body_stat_blocks_after === @@ -278,6 +336,38 @@ index_body_stat_blocks_before * 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 + + styles/subsilver2/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 + + styles/subsilver2/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 + + styles/subsilver2/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 + + styles/subsilver2/template/mcp_ban.html +* Since: 3.1.0-RC3 +* Purpose: Add additional fields to the unban form in MCP + memberlist_body_username_append === * Locations: @@ -344,6 +434,55 @@ memberlist_view_user_statistics_before * 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: @@ -356,9 +495,18 @@ overall_footer_breadcrumb_append === * Locations: + styles/prosilver/template/navbar_footer.html + + styles/subsilver2/template/breadcrumbs.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 + + styles/subsilver2/template/breadcrumbs.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: @@ -439,6 +587,30 @@ overall_header_breadcrumb_append * 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 + + styles/subsilver2/template/breadcrumbs.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 + + styles/subsilver2/template/breadcrumbs.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 + + styles/subsilver2/template/breadcrumbs.html +* Since: 3.1.0-RC3 +* Purpose: Add content before the breadcrumbs (outside of the breadcrumbs container) + overall_header_content_before === * Locations: @@ -495,6 +667,15 @@ overall_header_page_body_before * Since: 3.1.0-b3 * Purpose: Add content after the page-header, but before the page-body +overall_header_stylesheets_after +=== +* Locations: + + styles/prosilver/template/overall_header.html + + styles/subsilver2/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_buttons_after === * Locations: @@ -653,6 +834,15 @@ simple_header_head_append * 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 + + styles/subsilver2/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: @@ -721,6 +911,24 @@ 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 + + styles/subsilver2/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 + + styles/subsilver2/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_print_head_append === * Locations: @@ -767,7 +975,7 @@ ucp_prefs_view_radio_buttons_prepend + 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 @@ -776,7 +984,7 @@ ucp_prefs_view_radio_buttons_append + 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 @@ -785,7 +993,7 @@ ucp_prefs_view_select_menu_prepend + 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 @@ -794,9 +1002,49 @@ ucp_prefs_view_select_menu_append + 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_register_credentials_before +=== +* Locations: + + styles/prosilver/template/ucp_register.html + + styles/subsilver2/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 + + styles/subsilver2/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 + + styles/subsilver2/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 + + styles/subsilver2/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 + + styles/subsilver2/template/ucp_register.html +* Since: 3.1.0-b5 +* Purpose: Add options in registration page fieldset - before profile fields. + ucp_friend_list_before === * Locations: diff --git a/phpBB/download/file.php b/phpBB/download/file.php index ce2855473b..d4e0f04d2b 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -38,29 +38,31 @@ 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_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_config_php_file, $phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->get_container(); $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); @@ -73,11 +75,6 @@ if (isset($_GET['avatar'])) $db = $phpbb_container->get('dbal.conn'); $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); diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 59057a0447..2372c1f73c 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -1301,7 +1301,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. */ diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php index 7cc6741e23..361ef2666c 100644 --- a/phpBB/includes/acp/acp_ban.php +++ b/phpBB/includes/acp/acp_ban.php @@ -176,8 +176,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>'; @@ -196,60 +194,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_board.php b/phpBB/includes/acp/acp_board.php index 74df9240a1..f2707f15ca 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -410,7 +410,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,), @@ -925,7 +925,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. } diff --git a/phpBB/includes/acp/acp_contact.php b/phpBB/includes/acp/acp_contact.php index 13d38d9f29..4e46df21e0 100644 --- a/phpBB/includes/acp/acp_contact.php +++ b/phpBB/includes/acp/acp_contact.php @@ -1,9 +1,14 @@ <?php /** * -* @package acp -* @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/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 3ba1210b5c..8f9c155ffc 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -90,7 +90,7 @@ class acp_database $time = time(); $filename = 'backup_' . $time . '_' . unique_id(); - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysqli': case 'mysql4': @@ -119,10 +119,6 @@ class acp_database 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->write_start($table_prefix); @@ -137,11 +133,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 'sqlite3': - case 'firebird': $extractor->flush('DELETE FROM ' . $table_name . ";\n"); break; @@ -325,7 +320,7 @@ class acp_database break; } - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql': case 'mysql4': @@ -338,20 +333,6 @@ class acp_database } 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) @@ -384,10 +365,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; @@ -642,7 +623,7 @@ class mysql_extractor extends base_extractor if ($new_extract === null) { - if ($db->sql_layer === 'mysqli' || version_compare($db->sql_server_info(true), '3.23.20', '>=')) + if ($db->get_sql_layer() === 'mysqli' || version_compare($db->sql_server_info(true), '3.23.20', '>=')) { $new_extract = true; } @@ -665,7 +646,7 @@ class mysql_extractor extends base_extractor function write_data($table_name) { global $db; - if ($db->sql_layer === 'mysqli') + if ($db->get_sql_layer() === 'mysqli') { $this->write_data_mysqli($table_name); } @@ -680,7 +661,7 @@ class mysql_extractor extends base_extractor global $db; $sql = "SELECT * FROM $table_name"; - $result = mysqli_query($db->db_connect_id, $sql, MYSQLI_USE_RESULT); + $result = mysqli_query($db->get_db_connect_id(), $sql, MYSQLI_USE_RESULT); if ($result != false) { $fields_cnt = mysqli_num_fields($result); @@ -759,7 +740,7 @@ class mysql_extractor extends base_extractor global $db; $sql = "SELECT * FROM $table_name"; - $result = mysql_unbuffered_query($sql, $db->db_connect_id); + $result = mysql_unbuffered_query($sql, $db->get_db_connect_id()); if ($result != false) { @@ -1012,11 +993,11 @@ class sqlite_extractor extends base_extractor { global $db; - $col_types = sqlite_fetch_column_types($db->db_connect_id, $table_name); + $col_types = sqlite_fetch_column_types($db->get_db_connect_id(), $table_name); $sql = "SELECT * FROM $table_name"; - $result = sqlite_unbuffered_query($db->db_connect_id, $sql); + $result = sqlite_unbuffered_query($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) @@ -1572,11 +1553,11 @@ class mssql_extractor extends base_extractor { global $db; - if ($db->sql_layer === 'mssql') + if ($db->get_sql_layer() === 'mssql') { $this->write_data_mssql($table_name); } - else if($db->sql_layer === 'mssqlnative') + else if($db->get_sql_layer() === 'mssqlnative') { $this->write_data_mssqlnative($table_name); } @@ -2110,235 +2091,6 @@ class oracle_extractor extends base_extractor } } -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_extensions.php b/phpBB/includes/acp/acp_extensions.php index b2a6820461..9bdd8eb458 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -137,7 +137,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); } @@ -162,7 +168,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); } @@ -194,7 +206,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); } @@ -209,7 +221,7 @@ class acp_extensions break; case 'disable': - if (!$phpbb_extension_manager->enabled($ext_name)) + if (!$phpbb_extension_manager->is_enabled($ext_name)) { redirect($this->u_action); } @@ -234,7 +246,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); } @@ -248,7 +260,7 @@ class acp_extensions break; case 'delete_data': - if ($phpbb_extension_manager->enabled($ext_name)) + if ($phpbb_extension_manager->is_enabled($ext_name)) { redirect($this->u_action); } diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index f8c463e158..adf5de44f5 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1827,7 +1827,7 @@ class acp_forums } $db->sql_freeresult($result); - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql4': case 'mysqli': diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 259b9845a3..028025b547 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -538,11 +538,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 'sqlite3': - case 'firebird': $db->sql_query('DELETE FROM ' . $table); break; diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 3acefebedc..2a28226d6c 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -26,7 +26,7 @@ class acp_main function main($id, $mode) { global $config, $db, $cache, $user, $auth, $template, $request; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container, $phpbb_dispatcher; // Show restore permissions notice if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) @@ -269,11 +269,10 @@ class acp_main break; case 'db_track': - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': case 'sqlite3': - case 'firebird': $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); break; @@ -375,11 +374,10 @@ class acp_main foreach ($tables as $table) { - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': case 'sqlite3': - case 'firebird': $db->sql_query("DELETE FROM $table"); break; @@ -447,6 +445,14 @@ class acp_main )); } + /** + * 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']; diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 5932f4cddd..ea6b388328 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -766,7 +766,8 @@ class acp_modules /** * Update/Add module * - * @param bool $run_inline if set to true errors will be returned and no logs being written + * @param array &$module_data The module data + * @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) { diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 9715b9bce8..cd3616208d 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -253,7 +253,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); @@ -315,7 +315,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); @@ -519,7 +519,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 6540173433..cb408e304f 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -1238,7 +1238,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)) diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index b7f0df4614..fda6ef25ec 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -112,7 +112,7 @@ 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) + switch ($db->get_sql_layer()) { case 'sqlite': case 'sqlite3': @@ -1196,7 +1196,7 @@ class acp_profile { global $db; - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql': case 'mysql4': @@ -1267,11 +1267,6 @@ class acp_profile 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; diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index 2ddda28afc..a10b248324 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -436,8 +436,8 @@ class acp_prune $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 .= ($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 . ' ' : ''; diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index fdbd0e0a1d..5885de57ec 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -25,7 +25,7 @@ class acp_ranks function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $request; + global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang('acp/posting'); @@ -73,6 +73,17 @@ 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"; @@ -202,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'], @@ -212,9 +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 c5e8f1e2d0..3d7ccf422c 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -219,7 +219,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': @@ -252,7 +252,6 @@ class acp_reasons // Teh standard case 'postgres': case 'oracle': - case 'firebird': case 'sqlite': case 'sqlite3': // Change the reports using this reason to 'other' diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 3d0d27e8c9..2a02e3e845 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -209,8 +209,8 @@ class acp_styles 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); } @@ -804,7 +804,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) { @@ -888,7 +888,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) { diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index d07120a65f..71880c2267 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2384,7 +2384,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); @@ -2404,7 +2404,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/auth.php b/phpBB/includes/acp/auth.php index 7bb8e824d6..7ff3212b72 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -1024,7 +1024,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(); diff --git a/phpBB/includes/acp/info/acp_contact.php b/phpBB/includes/acp/info/acp_contact.php index b8326f34ea..548eb52816 100644 --- a/phpBB/includes/acp/info/acp_contact.php +++ b/phpBB/includes/acp/info/acp_contact.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @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/phpBB/includes/constants.php b/phpBB/includes/constants.php index 723956de0c..cd4e19bf1d 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.1.0-b5-dev'); +define('PHPBB_VERSION', '3.1.0-RC3-dev'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index dd0fbcee02..d307880c4b 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -46,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) { @@ -491,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/functions.php b/phpBB/includes/functions.php index 3d0a4761f3..4318b20b97 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -21,6 +21,37 @@ if (!defined('IN_PHPBB')) // Common global functions /** +* Load the autoloaders added by the extensions. +* +* @param string $phpbb_root_path Path to the phpbb root directory. +*/ +function phpbb_load_extensions_autoloaders($phpbb_root_path) +{ + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $phpbb_root_path . 'ext/', + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + $iterator->setMaxDepth(2); + + foreach ($iterator as $file_info) + { + if ($file_info->getFilename() === 'vendor' && $iterator->getDepth() === 2) + { + $filename = $file_info->getRealPath() . '/autoload.php'; + if (file_exists($filename)) + { + require $filename; + } + } + } +} + +/** * Casts a variable to the given type. * * @deprecated @@ -1000,7 +1031,7 @@ function phpbb_get_timezone_identifiers($selected_timezone) $validate_timezone = new DateTimeZone($selected_timezone); $timezones[] = $selected_timezone; } - catch (Exception $e) + catch (\Exception $e) { } } @@ -1036,7 +1067,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) $offset_string = phpbb_format_timezone_offset($offset); $timezones['GMT' . $offset_string . ' - ' . $timezone] = array( 'tz' => $timezone, - 'offest' => 'GMT' . $offset_string, + 'offset' => 'GMT' . $offset_string, 'current' => $current_time, ); if ($timezone === $default) @@ -1053,14 +1084,14 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) foreach ($timezones as $timezone) { - if ($opt_group != $timezone['offest']) + if ($opt_group != $timezone['offset']) { $tz_select .= ($opt_group) ? '</optgroup>' : ''; - $tz_select .= '<optgroup label="' . $timezone['offest'] . ' - ' . $timezone['current'] . '">'; - $opt_group = $timezone['offest']; + $tz_select .= '<optgroup label="' . $timezone['offset'] . ' - ' . $timezone['current'] . '">'; + $opt_group = $timezone['offset']; - $selected = ($default_offset == $timezone['offest']) ? ' selected="selected"' : ''; - $tz_dates .= '<option value="' . $timezone['offest'] . ' - ' . $timezone['current'] . '"' . $selected . '>' . $timezone['offest'] . ' - ' . $timezone['current'] . '</option>'; + $selected = ($default_offset == $timezone['offset']) ? ' selected="selected"' : ''; + $tz_dates .= '<option value="' . $timezone['offset'] . ' - ' . $timezone['current'] . '"' . $selected . '>' . $timezone['offset'] . ' - ' . $timezone['current'] . '</option>'; } $label = $timezone['tz']; @@ -1068,7 +1099,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) { $label = $user->lang['timezones'][$label]; } - $title = $timezone['offest'] . ' - ' . $label; + $title = $timezone['offset'] . ' - ' . $label; if ($truncate) { @@ -2179,7 +2210,7 @@ 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; + global $db, $cache, $config, $user, $phpbb_root_path, $phpbb_filesystem, $phpbb_path_helper, $phpEx, $phpbb_dispatcher; $failover_flag = false; @@ -2188,11 +2219,6 @@ function redirect($url, $return = false, $disable_cd_check = false) $user->add_lang('common'); } - if (!$return) - { - garbage_collection(); - } - // Make sure no &'s are in, this will break the redirect $url = str_replace('&', '&', $url); @@ -2267,10 +2293,26 @@ 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'))) @@ -3998,7 +4040,7 @@ function obtain_guest_count($item_id = 0, $item = 'forum') // Get number of online guests - if ($db->sql_layer === 'sqlite' || $db->sql_layer === 'sqlite3') + if ($db->get_sql_layer() === 'sqlite' || $db->get_sql_layer() === 'sqlite3') { $sql = 'SELECT COUNT(session_ip) as num_guests FROM ( @@ -4881,6 +4923,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = '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'] : '', @@ -4923,7 +4966,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = '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_CONTACT_US' => ($config['contact_admin_form_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') : '', + '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'), @@ -5064,10 +5107,10 @@ function phpbb_generate_debug_output(phpbb\db\driver\driver_interface $db, \phpb if (isset($GLOBALS['starttime'])) { $totaltime = microtime(true) - $GLOBALS['starttime']; - $debug_info[] = sprintf('Time: %.3fs', $totaltime); + $debug_info[] = sprintf('<abbr title="SQL time: %.3fs / PHP time: %.3fs">Time: %.3fs</abbr>', $db->get_sql_time(), ($totaltime - $db->get_sql_time()), $totaltime); } - $debug_info[] = $db->sql_num_queries() . ' Queries (' . $db->sql_num_queries(true) . ' cached)'; + $debug_info[] = sprintf('<abbr title="Cached: %d">Queries: %d</abbr>', $db->sql_num_queries(true), $db->sql_num_queries()); $memory_usage = memory_get_peak_usage(); if ($memory_usage) @@ -5295,52 +5338,6 @@ 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. -* -* @param string $dbms dbms parameter -* @return db driver class -*/ -function phpbb_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"); -} - -/** * Get the board contact details (e.g. for emails) * * @param \phpbb\config\config $config @@ -5369,7 +5366,7 @@ function phpbb_get_board_contact(\phpbb\config\config $config, $phpEx) */ function phpbb_get_board_contact_link(\phpbb\config\config $config, $phpbb_root_path, $phpEx) { - if ($config['contact_admin_form_enable']) + if ($config['contact_admin_form_enable'] && $config['email_enable']) { return append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); } diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index 8453da6e6e..ad5a359710 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -240,7 +240,6 @@ 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]; diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 2d3ac62f86..accc8a6a83 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1435,7 +1435,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': @@ -2441,11 +2441,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 'sqlite3': - case 'firebird': $db->sql_query('DELETE FROM ' . MODERATOR_CACHE_TABLE); break; @@ -2492,7 +2491,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); @@ -2698,11 +2697,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 @@ -2855,7 +2854,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': @@ -2871,7 +2870,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; @@ -2900,17 +2899,6 @@ 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; @@ -2958,7 +2946,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); diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php deleted file mode 100644 index 5794d2f403..0000000000 --- a/phpBB/includes/functions_container.php +++ /dev/null @@ -1,291 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.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\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_interface -*/ -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_CONTAINER') ? '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 74b3e0c70f..ee78364083 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -174,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; @@ -188,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++) { @@ -1334,9 +1336,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>'; } @@ -1452,16 +1454,19 @@ 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)), )); } diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 9005c57c8a..9d480692e9 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1647,7 +1647,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': @@ -2041,11 +2041,10 @@ function update_topics_posted() { global $db, $config; - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': case 'sqlite3': - case 'firebird': $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); break; diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 4606a9f7ca..62f218cf60 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -622,7 +622,7 @@ 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'), )); if ($return_moderators) @@ -674,6 +674,8 @@ function generate_forum_nav(&$forum_data) // Get forum parents $forum_parents = get_forum_parents($forum_data); + $microdata_attr = 'data-forum-id'; + // Build navigation links if (!empty($forum_parents)) { @@ -693,6 +695,7 @@ function generate_forum_nav(&$forum_data) 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false, 'FORUM_NAME' => $parent_name, 'FORUM_ID' => $parent_forum_id, + 'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"', 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id)) ); } @@ -704,6 +707,7 @@ function generate_forum_nav(&$forum_data) 'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_ID' => $forum_data['forum_id'], + 'MICRODATA' => $microdata_attr . '="' . $forum_data['forum_id'] . '"', 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id'])) ); @@ -1059,7 +1063,8 @@ function display_reasons($reason_id = 0) function display_user_activity(&$userdata) { 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) @@ -1130,6 +1135,18 @@ function display_user_activity(&$userdata) } } + /** + * 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['active_t_row'] = $active_t_row; $userdata['active_f_row'] = $active_f_row; @@ -1409,7 +1426,7 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank * @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 +* @param string $phpEx The PHP file extension * * @return array Array containing the link and the type of compression */ @@ -1440,3 +1457,166 @@ function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $php return $links; } + +/** +* Prepare profile data +*/ +function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false) +{ + global $config, $auth, $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_active = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit']; + } + else + { + $last_active = ''; + } + + $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')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + // Can this user receive a Private Message? + $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' => $rank_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' => $rank_img, + 'RANK_IMG_SRC' => $rank_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' => $data['user_jabber'], + 'USER_JABBER_IMG' => ($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; +} + +function phpbb_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/includes/functions_install.php b/phpBB/includes/functions_install.php index 1c66489c31..28cc603bdb 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -27,15 +27,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 { 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( @@ -260,7 +251,6 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $prefix_length = 200; break; - case 'phpbb\db\driver\firebird': case 'phpbb\db\driver\oracle': $prefix_length = 6; break; @@ -276,7 +266,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, 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']); + $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? utf8_convert_message($db_error['message']) : $lang['INST_ERR_DB_NO_ERROR']); } else { @@ -300,7 +290,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, switch ($dbms_details['DRIVER']) { case 'phpbb\db\driver\mysqli': - if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) + if (version_compare(mysqli_get_server_info($db->get_db_connect_id()), '4.1.3', '<')) { $error[] = $lang['INST_ERR_DB_NO_MYSQLI']; } @@ -321,87 +311,6 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, } 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) { @@ -540,6 +449,7 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_cont } $config_data .= "\n@define('PHPBB_INSTALLED', true);\n"; + $config_data .= "// @define('PHPBB_DISPLAY_LOAD_TIME', true);\n"; if ($debug) { diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php new file mode 100644 index 0000000000..7593f08f4d --- /dev/null +++ b/phpBB/includes/functions_mcp.php @@ -0,0 +1,666 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.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); + + $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, &$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') ? 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 = 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 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_module.php b/phpBB/includes/functions_module.php index b7615e923b..397e6401ff 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -250,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; @@ -529,7 +541,9 @@ 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) { @@ -1028,19 +1042,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_unique(array_merge($user_lang_files, $english_lang_files, $default_lang_files)); foreach ($lang_files as $lang_file => $ext_name) { $user->add_lang_ext($ext_name, $lang_file); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 20798f9f1b..fb09bc7057 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -398,14 +398,15 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) * @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\mimetype\guesser $mimetype_guesser The mimetype guesser object if used * @param \phpbb\plupload\plupload $plupload The plupload object if one is being used * * @return object filespec */ -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, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) { global $auth, $user, $config, $db, $cache; - global $phpbb_root_path, $phpEx; + global $phpbb_root_path, $phpEx, $phpbb_dispatcher; $filedata = array( 'error' => array() @@ -434,7 +435,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage $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); + $file = ($local) ? $upload->local_upload($local_storage, $local_filedata, $mimetype_guesser) : $upload->form_upload($form_name, $mimetype_guesser, $plupload); if ($file->init_error) { @@ -506,6 +507,20 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage $filedata['real_filename'] = $file->get('uploadname'); $filedata['filetime'] = time(); + /** + * 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($phpbb_dispatcher->trigger_event('core.modify_uploaded_file', compact($vars))); + // Check our complete quota if ($config['attachment_quota']) { @@ -893,7 +908,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(); @@ -936,7 +951,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); @@ -947,6 +962,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); @@ -2360,12 +2389,31 @@ 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 + * @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 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', + 'update_message', + 'update_search_index', + 'url', + ); extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars))); return $url; @@ -2472,3 +2520,137 @@ function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false) 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, $soft_delete_reason = '') +{ + global $user, $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, $soft_delete_reason); + + $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, $soft_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 92655cd035..488f46a398 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -212,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'); } @@ -988,7 +988,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_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher; $user_id = (int) $user_id; $folder_id = (int) $folder_id; @@ -1012,6 +1012,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 . ' @@ -1906,6 +1918,19 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) $phpbb_notifications->add_notifications('pm', $pm_data); } + /** + * 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))); + return $data['msg_id']; } diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index c640865212..e973e6ec28 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -53,10 +53,16 @@ class filespec protected $plupload; /** + * phpBB Mimetype guesser + * @var \phpbb\mimetype\guesser + */ + protected $mimetype_guesser; + + /** * File Class * @access private */ - function filespec($upload_ary, $upload_namespace, \phpbb\plupload\plupload $plupload = null) + function filespec($upload_ary, $upload_namespace, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) { if (!isset($upload_ary)) { @@ -76,7 +82,7 @@ class filespec if (!$this->mimetype) { - $this->mimetype = 'application/octetstream'; + $this->mimetype = 'application/octet-stream'; } $this->extension = strtolower(self::get_extension($this->realname)); @@ -90,6 +96,7 @@ class filespec $this->local = (isset($upload_ary['local_mode'])) ? true : false; $this->upload = $upload_namespace; $this->plupload = $plupload; + $this->mimetype_guesser = $mimetype_guesser; } /** @@ -97,6 +104,7 @@ class filespec * * @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 + * @param string $user_id The user_id is only needed for when cleaning a user's avatar * @access public */ function clean_filename($mode = 'unique', $prefix = '', $user_id = '') @@ -215,25 +223,19 @@ class filespec } /** - * Get mimetype. Utilize mime_content_type if the function exist. - * Not used at the moment... + * Get mimetype + * + * @param string $filename Filename that needs to be checked + * @return string Mimetype of supplied filename */ 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') + if ($this->mimetype_guesser !== null) { - $mimetype = 'application/octetstream'; + $this->mimetype = $this->mimetype_guesser->guess($filename); } - return $mimetype; + return $this->mimetype; } /** @@ -276,8 +278,9 @@ class filespec * 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 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 $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 @@ -372,6 +375,9 @@ class filespec // Try to get real filesize from destination folder $this->filesize = (@filesize($this->destination_file)) ? @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; @@ -485,6 +491,9 @@ class fileupload var $max_height = 0; var $error_prefix = ''; + /** @var int Timeout for remote upload */ + var $upload_timeout = 6; + /** * Init file upload class. * @@ -495,6 +504,8 @@ class fileupload * @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) + * @param bool|array $disallowed_content If enabled, the first 256 bytes of the file must not + * contain any of its values. Defaults to false. * */ 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) @@ -580,7 +591,7 @@ class fileupload * @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) + function form_upload($form_name, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) { global $user, $request; @@ -596,7 +607,7 @@ class fileupload } } - $file = new filespec($upload, $this, $plupload); + $file = new filespec($upload, $this, $mimetype_guesser, $plupload); if ($file->init_error) { @@ -656,7 +667,7 @@ class fileupload /** * Move file from another location to phpBB */ - function local_upload($source_file, $filedata = false) + function local_upload($source_file, $filedata = false, \phpbb\mimetype\guesser $mimetype_guesser = null) { global $user, $request; @@ -669,20 +680,6 @@ class fileupload { $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 { @@ -691,7 +688,7 @@ class fileupload $upload['type'] = $filedata['type']; } - $file = new filespec($upload, $this); + $file = new filespec($upload, $this, $mimetype_guesser); if ($file->init_error) { @@ -749,7 +746,7 @@ class fileupload * @return object $file Object "filespec" is returned, all further operations can be done with this object * @access public */ - function remote_upload($upload_url) + function remote_upload($upload_url, \phpbb\mimetype\guesser $mimetype_guesser = null) { global $user, $phpbb_root_path; @@ -828,13 +825,28 @@ class fileupload 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_timeout); + $get_info = false; $data = ''; - while (!@feof($fsock)) + $length = false; + $timer_stop = time() + $this->upload_timeout; + + while ((!$length || $filesize < $length) && !@feof($fsock)) { if ($get_info) { - $block = @fread($fsock, 1024); + 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) @@ -880,6 +892,15 @@ class fileupload } } } + + $stream_meta_data = stream_get_meta_data($fsock); + + // Cancel upload if we exceed timeout + if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop) + { + $file = new fileerror($user->lang[$this->error_prefix . 'REMOTE_UPLOAD_TIMEOUT']); + return $file; + } } @fclose($fsock); @@ -904,7 +925,7 @@ class fileupload $upload_ary['tmp_name'] = $filename; - $file = new filespec($upload_ary, $this); + $file = new filespec($upload_ary, $this, $mimetype_guesser); $this->common_checks($file); return $file; diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php index 7e17d1c2d8..b965046aad 100644 --- a/phpBB/includes/functions_url_matcher.php +++ b/phpBB/includes/functions_url_matcher.php @@ -29,7 +29,7 @@ if (!defined('IN_PHPBB')) * @param \phpbb\extension\manager $manager Extension manager * @param RequestContext $context Symfony RequestContext object * @param string $root_path Root path -* @param string $php_ext PHP extension +* @param string $php_ext PHP file extension * @return null */ function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path, $php_ext) @@ -52,7 +52,7 @@ function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext * * @param \phpbb\extension\manager $manager Extension manager * @param string $root_path Root path -* @param string $php_ext PHP extension +* @param string $php_ext PHP file extension * @return null */ function phpbb_create_dumped_url_matcher(\phpbb\extension\manager $manager, $root_path, $php_ext) @@ -88,7 +88,7 @@ function phpbb_create_url_matcher(\phpbb\extension\manager $manager, RequestCont * * @param RequestContext $context Symfony RequestContext object * @param string $root_path Root path -* @param string $php_ext PHP extension +* @param string $php_ext PHP file extension * @return phpbb_url_matcher */ function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext) @@ -103,7 +103,7 @@ function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext) * The class is automatically dumped to the cache directory * * @param string $root_path Root path -* @param string $php_ext PHP extension +* @param string $php_ext PHP file extension * @return bool True if it exists, false if not */ function phpbb_url_matcher_dumped($root_path, $php_ext) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 5a10f9f411..d39be50251 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -261,10 +261,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.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); @@ -344,6 +347,18 @@ function user_add($user_row, $cp_data = false) set_config('newest_user_colour', $row['group_colour'], true); } + /** + * 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; } @@ -1122,7 +1137,7 @@ 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 to admin log, moderator 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); if ($mode == 'user') @@ -3530,3 +3545,23 @@ function phpbb_get_banned_user_ids($user_ids = array(), $ban_end = true) 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/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index d9ee53fe30..e6fac3b80c 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -185,7 +185,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 e63888e70e..0c6acaa908 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -102,7 +102,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)) : ''; @@ -328,7 +328,7 @@ function mcp_resync_topics($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; } @@ -380,7 +380,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $sync_topics = array_merge($topic_ids, array($to_topic_id)); - $topic_data = get_topic_data($sync_topics, 'm_merge'); + $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) { @@ -420,7 +420,7 @@ 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; } diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 04206a6fcd..98773d5b0e 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -178,6 +178,18 @@ function mcp_front_view($id, $mode, $action) 'ORDER_BY' => 'p.post_time 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); diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index 2945e1ec8a..92dcdb5499 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -115,7 +115,7 @@ class mcp_logs if ($deletemark && sizeof($marked)) { $conditions = array( - 'forum_id' => $forum_list, + 'forum_id' => array('IN' => $forum_list), 'log_id' => array('IN' => $marked), ); @@ -126,7 +126,7 @@ class mcp_logs $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); $conditions = array( - 'forum_id' => $forum_list, + 'forum_id' => array('IN' => $forum_list), 'keywords' => $keywords, ); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 84097327bd..9f6125f256 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -187,7 +187,7 @@ class mcp_main $forum_id = request_var('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)) { @@ -252,7 +252,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') @@ -262,7 +262,7 @@ 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; } @@ -286,7 +286,7 @@ 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) { @@ -346,7 +346,7 @@ 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) { @@ -388,7 +388,7 @@ 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) { @@ -422,7 +422,7 @@ function mcp_move_topic($topic_ids) global $phpEx, $phpbb_root_path; // 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) { @@ -442,7 +442,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)) { @@ -479,7 +479,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(); @@ -677,7 +677,7 @@ function mcp_restore_topic($topic_ids) { global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container; - 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; } @@ -697,7 +697,7 @@ 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); $phpbb_content_visibility = $phpbb_container->get('content.visibility'); foreach ($data as $topic_id => $row) @@ -750,7 +750,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' { global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container; - if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete'))) + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete'))) { return; } @@ -770,7 +770,7 @@ 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) { @@ -878,7 +878,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', { global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container; - if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_softdelete'))) + if (!phpbb_check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_softdelete'))) { return; } @@ -896,7 +896,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(); @@ -984,7 +984,7 @@ 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) { @@ -1105,7 +1105,7 @@ function mcp_fork_topic($topic_ids) global $auth, $user, $db, $template, $config; global $phpEx, $phpbb_root_path; - if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) { return; } @@ -1124,7 +1124,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)) { @@ -1161,7 +1161,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; diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 7e39c157c1..03e4ed4722 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -100,7 +100,7 @@ class mcp_pm_reports $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)) { @@ -216,7 +216,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)) : ''; diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index d2cc5d285e..1687409198 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -33,7 +33,7 @@ function mcp_post_details($id, $mode, $action) $start = request_var('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'); @@ -43,7 +43,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) { @@ -151,6 +151,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); } @@ -508,7 +509,7 @@ function change_poster(&$post_info, $userdata) $to_username = $userdata['username']; // 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)) { diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index e2ca3a8752..37ce3c6fc3 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -159,7 +159,7 @@ class mcp_queue 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']; @@ -174,7 +174,7 @@ class mcp_queue $phpbb_notifications->mark_notifications_read('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)) { @@ -343,7 +343,7 @@ class mcp_queue if ($topic_id) { - $topic_info = get_topic_data(array($topic_id)); + $topic_info = phpbb_get_topic_data(array($topic_id)); if (!sizeof($topic_info)) { @@ -389,7 +389,7 @@ 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)) { @@ -409,7 +409,7 @@ class mcp_queue $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)) : ''; @@ -572,7 +572,7 @@ class mcp_queue global $db, $template, $user, $config, $request, $phpbb_container; global $phpEx, $phpbb_root_path; - 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'); } @@ -591,7 +591,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)) { @@ -795,7 +795,7 @@ class mcp_queue global $db, $template, $user, $config; global $phpEx, $phpbb_root_path, $request, $phpbb_container; - 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'); } @@ -813,7 +813,7 @@ 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)) { @@ -964,7 +964,7 @@ class mcp_queue global $db, $template, $user, $config, $phpbb_container; global $phpEx, $phpbb_root_path, $request; - 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'); } @@ -1016,7 +1016,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) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index b0148356ce..a7d8bf18d6 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -106,7 +106,7 @@ class mcp_reports $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; - $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)) { @@ -269,7 +269,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)) { @@ -312,7 +312,7 @@ 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)) { @@ -338,7 +338,7 @@ 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)) : ''; @@ -479,7 +479,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'); } @@ -515,7 +515,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 diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index f8ce8aae7b..1698b080c9 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -27,13 +27,13 @@ function mcp_topic_view($id, $mode, $action) global $phpEx, $phpbb_root_path, $config; global $template, $db, $user, $auth, $cache, $phpbb_container; - $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'); $pagination = $phpbb_container->get('pagination'); $topic_id = request_var('t', 0); - $topic_info = get_topic_data(array($topic_id), false, true); + $topic_info = phpbb_get_topic_data(array($topic_id), false, true); if (!sizeof($topic_info)) { @@ -114,7 +114,7 @@ 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)) : ''; $phpbb_content_visibility = $phpbb_container->get('content.visibility'); @@ -278,7 +278,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)) { @@ -368,13 +368,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)) { @@ -398,7 +398,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)) { @@ -438,7 +438,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)) : ''; @@ -505,7 +505,7 @@ 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); @@ -594,7 +594,7 @@ function merge_posts($topic_id, $to_topic_id) $sync_topics = array($topic_id, $to_topic_id); - $topic_data = get_topic_data($sync_topics, 'm_merge'); + $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) { @@ -619,7 +619,7 @@ 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; } diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 6d3907880e..92ace7b585 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1083,6 +1083,12 @@ class parse_message extends bbcode_firstpass protected $plupload; /** + * The mimetype guesser object used for attachment mimetypes + * @var \phpbb\mimetype\guesser + */ + protected $mimetype_guesser; + + /** * Init - give message here or manually */ function parse_message($message = '') @@ -1194,6 +1200,15 @@ class parse_message extends bbcode_firstpass } } + // 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', $this->message, $matches)) + { + $character_list = implode('<br />', $matches[0]); + $this->warn_msg[] = $user->lang('UNSUPPORTED_CHARACTERS_MESSAGE', $character_list); + return $update_this_message ? $this->warn_msg : $return_message; + } + // Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length. // The maximum length check happened before any parsings. if ($mode === 'post' && utf8_clean_string($this->message) === '') @@ -1341,7 +1356,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': @@ -1351,12 +1366,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 * @@ -1557,7 +1566,7 @@ 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); + $filedata = upload_attachment($form_name, $forum_id, false, '', $is_message, false, $this->mimetype_guesser, $this->plupload); $error = array_merge($error, $filedata['error']); if (!sizeof($error)) @@ -1789,4 +1798,16 @@ class parse_message extends bbcode_firstpass { $this->plupload = $plupload; } + + /** + * Setter function for passing the mimetype_guesser object + * + * @param \phpbb\mimetype\guesser $mimetype_guesser The mimetype_guesser object + * + * @return null + */ + public function set_mimetype_guesser(\phpbb\mimetype\guesser $mimetype_guesser) + { + $this->mimetype_guesser = $mimetype_guesser; + } } diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index b4b01a74bf..63ea432863 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -257,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_root_path, $phpEx, $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/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index fc568abc68..94383b935f 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -85,7 +85,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 { @@ -204,6 +213,7 @@ 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'], + '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), diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 35bb844170..a8c8920a7d 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -43,7 +43,7 @@ class ucp_prefs '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']), + 'user_style' => request_var('user_style', (int) $user->data['user_style']), 'tz' => request_var('tz', $user->data['user_timezone']), 'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']), @@ -76,11 +76,11 @@ class ucp_prefs { 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( @@ -107,7 +107,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'], ); /** @@ -115,7 +115,7 @@ 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 + * @var array sql_ary Display options data we update * @since 3.1.0-a1 */ $vars = array('data', 'sql_ary'); @@ -207,7 +207,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_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['user_style']), 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], 'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false, @@ -294,7 +294,7 @@ 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 + * @var array sql_ary Display options data we update * @since 3.1.0-a1 */ $vars = array('data', 'sql_ary'); @@ -420,7 +420,7 @@ 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 + * @var array sql_ary Display options data we update * @since 3.1.0-a1 */ $vars = array('data', 'sql_ary'); @@ -451,6 +451,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 5ba5f1e830..a315b167d7 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -393,8 +393,9 @@ class ucp_profile } $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', - 'JABBER' => $data['jabber'], + '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' diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 7daacf92f4..696075b07c 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -25,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 @@ -37,7 +38,7 @@ $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-b4', + 'phpbb_version' => '3.1.0-RC2', 'author' => '<a href="https://www.phpbb.com/">phpBB Limited</a>', 'dbms' => $dbms, 'dbhost' => $dbhost, diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index a2bfabd2fd..01447a6232 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -92,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': @@ -289,7 +289,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 . '));'); @@ -1768,7 +1768,7 @@ function phpbb_create_userconv_table() global $db, $src_db, $convert, $table_prefix, $user, $lang; $map_dbms = ''; - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mysql': $map_dbms = 'mysql_40'; @@ -1796,7 +1796,7 @@ function phpbb_create_userconv_table() break; default: - $map_dbms = $db->sql_layer; + $map_dbms = $db->get_sql_layer(); break; } @@ -1804,13 +1804,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 , diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 44dbe43cf8..517143792a 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -41,7 +41,9 @@ function phpbb_end_update($cache, $config) </div> <div id="page-footer"> - Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited + <div class="copyright"> + Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited + </div> </div> </div> </body> @@ -54,8 +56,14 @@ function phpbb_end_update($cache, $config) } require($phpbb_root_path . 'includes/startup.' . $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()); -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."); @@ -66,13 +74,9 @@ $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); -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); @@ -80,26 +84,12 @@ 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(); +$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); +$phpbb_container_builder->set_use_extensions(false); +$phpbb_container_builder->set_use_kernel_pass(false); +$phpbb_container_builder->set_dump_container(false); +$phpbb_container = $phpbb_container_builder->get_container(); // set up caching $cache = $phpbb_container->get('cache'); @@ -174,7 +164,7 @@ header('Content-type: text/html; charset=UTF-8'); <br /> - <p><?php echo $user->lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->sql_layer; ?></strong><br /> + <p><?php echo $user->lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->get_sql_layer(); ?></strong><br /> <?php echo $user->lang['PREVIOUS_VERSION']; ?> :: <strong><?php echo $config['version']; ?></strong><br /> <?php @@ -182,30 +172,14 @@ header('Content-type: text/html; charset=UTF-8'); define('IN_DB_UPDATE', true); /** -* @todo firebird/mysql update? +* @todo 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'); +$migrator->create_migrations_table(); + $phpbb_extension_manager = $phpbb_container->get('ext.manager'); $finder = $phpbb_extension_manager->get_finder(); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index bff7b75b18..d443c537fa 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -102,7 +102,6 @@ $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_ro 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); @@ -120,7 +119,29 @@ $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/" $phpbb_class_loader_ext->register(); // Set up container -$phpbb_container = phpbb_create_install_container($phpbb_root_path, $phpEx); +$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); +$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); +$phpbb_container_builder->set_use_extensions(false); +$phpbb_container_builder->set_dump_container(false); +$phpbb_container_builder->set_use_custom_pass(false); +$phpbb_container_builder->set_inject_config(false); +$phpbb_container_builder->set_compile_container(false); + +$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/'; +$phpbb_container_builder->set_config_path($config_path); + +$phpbb_container_builder->set_custom_parameters(array( + 'core.root_path' => $phpbb_root_path, + 'core.adm_relative_path' => $phpbb_adm_relative_path, + 'core.php_ext' => $phpEx, + 'core.table_prefix' => '', + 'cache.driver.class' => 'phpbb\cache\driver\file', +)); + +$phpbb_container = $phpbb_container_builder->get_container(); +$phpbb_container->register('dbal.conn.driver')->setSynthetic(true); +$phpbb_container->compile(); $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); @@ -688,7 +709,7 @@ class module )); // Rollback if in transaction - if ($db->transaction) + if ($db->get_transaction()) { $db->sql_transaction('rollback'); } diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 4d6aff154c..17161b5eae 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -107,7 +107,7 @@ class install_convert extends module function main($mode, $sub) { global $lang, $template, $phpbb_root_path, $phpEx, $cache, $config, $language, $table_prefix; - global $convert, $request, $phpbb_container; + global $convert, $request, $phpbb_container, $phpbb_config_php_file; $this->tpl_name = 'install_convert'; $this->mode = $mode; @@ -127,7 +127,8 @@ class install_convert extends module // 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); + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->get_container(); // Create cache $cache = $phpbb_container->get('cache'); @@ -135,11 +136,12 @@ class install_convert extends module switch ($sub) { case 'intro': - require($phpbb_root_path . 'config.' . $phpEx); + extract($phpbb_config_php_file->get_all()); + require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); - $dbms = phpbb_convert_30_dbms_to_31($dbms); + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); $db = new $dbms(); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); @@ -224,11 +226,12 @@ class install_convert extends module // 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); + extract($phpbb_config_php_file->get_all()); + require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); - $dbms = phpbb_convert_30_dbms_to_31($dbms); + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); $db = new $dbms(); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); @@ -248,11 +251,10 @@ class install_convert extends module )); } - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': case 'sqlite3': - case 'firebird': $db->sql_query('DELETE FROM ' . SESSIONS_KEYS_TABLE); $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); break; @@ -371,13 +373,14 @@ class install_convert extends module */ function get_convert_settings($sub) { - global $lang, $language, $template, $db, $phpbb_root_path, $phpEx, $config, $cache; + global $lang, $language, $template, $db, $phpbb_root_path, $phpEx, $config, $cache, $phpbb_config_php_file; + + extract($phpbb_config_php_file->get_all()); - 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); + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); $db = new $dbms(); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); @@ -459,7 +462,8 @@ class install_convert extends module { $error[] = sprintf($lang['TABLE_PREFIX_SAME'], $src_table_prefix); } - $src_dbms = phpbb_convert_30_dbms_to_31($src_dbms); + + $src_dbms = $phpbb_config_php_file->convert_30_dbms_to_31($src_dbms); // Check table prefix if (!sizeof($error)) @@ -615,13 +619,14 @@ class install_convert extends module { global $template, $user, $phpbb_root_path, $phpEx, $db, $lang, $config, $cache, $auth; global $convert, $convert_row, $message_parser, $skip_rows, $language; - global $request; + global $request, $phpbb_config_php_file; + + extract($phpbb_config_php_file->get_all()); - 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); + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); $db = new $dbms(); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); @@ -700,7 +705,6 @@ class install_convert extends module { case 'sqlite': case 'sqlite3': - case 'firebird': $convert->src_truncate_statement = 'DELETE FROM '; break; @@ -729,11 +733,10 @@ class install_convert extends module $src_db->sql_query("SET NAMES 'binary'"); } - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'sqlite': case 'sqlite3': - case 'firebird': $convert->truncate_statement = 'DELETE FROM '; break; @@ -1132,7 +1135,7 @@ class install_convert extends module if (!empty($schema['autoincrement'])) { - switch ($db->sql_layer) + switch ($db->get_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'] . '));'); @@ -1271,7 +1274,7 @@ class install_convert extends module if (!empty($schema['autoincrement'])) { - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mssql': case 'mssql_odbc': @@ -1304,7 +1307,7 @@ class install_convert extends module if ($sql_flag === true) { - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { // If MySQL, we'll wait to have num_wait_rows rows to submit at once case 'mysql': @@ -1399,7 +1402,7 @@ class install_convert extends module if (!empty($schema['autoincrement'])) { - switch ($db->sql_layer) + switch ($db->get_sql_layer()) { case 'mssql': case 'mssql_odbc': @@ -1638,7 +1641,7 @@ class install_convert extends module 'RESULT' => $user->lang['DONE'], )); - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { $template->assign_vars(array( 'S_ERROR_BOX' => true, @@ -1811,7 +1814,7 @@ class install_convert extends module global $convert; // Can we use IGNORE with this DBMS? - $sql_ignore = (strpos($db->sql_layer, 'mysql') === 0 && !defined('DEBUG')) ? 'IGNORE ' : ''; + $sql_ignore = (strpos($db->get_sql_layer(), 'mysql') === 0 && !defined('DEBUG')) ? 'IGNORE ' : ''; $insert_query = 'INSERT ' . $sql_ignore . 'INTO ' . $schema['target'] . ' ('; $aliases = array(); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 576cbba3ca..b82df84a00 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -51,7 +51,7 @@ class install_install extends module function main($mode, $sub) { global $lang, $template, $language, $phpbb_root_path, $phpEx; - global $phpbb_container, $cache, $phpbb_log, $request; + global $phpbb_container, $cache, $phpbb_log, $request, $phpbb_config_php_file; switch ($sub) { @@ -104,7 +104,8 @@ class install_install extends module $request->enable_super_globals(); // Create a normal container now - $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->get_container(); // Sets the global variables $cache = $phpbb_container->get('cache'); @@ -1153,21 +1154,25 @@ class install_install extends module // 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) + if (file_exists($dbms_schema)) { - //$sql = trim(str_replace('|', ';', $sql)); - if (!$db->sql_query($sql)) + $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) { - $error = $db->sql_error(); - $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); + //$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); } - unset($sql_query); // Ok we have the db info go ahead and work on building the table $db_table_schema = @file_get_contents('schemas/schema.json'); @@ -1528,10 +1533,10 @@ class install_install extends module $_module->update_module_data($module_data, true); // Check for last sql error happened - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } $categories[$cat_name]['id'] = (int) $module_data['module_id']; @@ -1562,10 +1567,10 @@ class install_install extends module $_module->update_module_data($module_data, true); // Check for last sql error happened - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } $categories[$level2_name]['id'] = (int) $module_data['module_id']; @@ -1602,10 +1607,10 @@ class install_install extends module $_module->update_module_data($module_data, true); // Check for last sql error happened - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } } } @@ -1768,10 +1773,10 @@ class install_install extends module $_module->update_module_data($module_data, true); // Check for last sql error happened - if ($db->sql_error_triggered) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } } } @@ -1820,10 +1825,10 @@ class install_install extends module $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) + if ($db->get_sql_error_triggered()) { - $error = $db->sql_error($db->sql_error_sql); - $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__); + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); } } } @@ -1909,7 +1914,7 @@ class install_install extends module 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); + $this->p_master->db_error('Unable to insert bot into users table', $db->get_sql_error_sql(), __LINE__, __FILE__, true); continue; } diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index ab5fcc3f2b..28777a8d24 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -66,7 +66,7 @@ class install_update extends module 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; + global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container, $phpbb_config_php_file; // 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: @@ -74,14 +74,14 @@ class install_update extends module $request->enable_super_globals(); // Create a normal container now + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); + $phpbb_container_builder->set_dump_container(false); + $phpbb_container_builder->set_use_extensions(false); if (file_exists($phpbb_root_path . 'install/update/new/config')) { - $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config'); - } - else - { - $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'config'); + $phpbb_container_builder->set_config_path($phpbb_root_path . 'install/update/new/config'); } + $phpbb_container = $phpbb_container_builder->get_container(); // Writes into global $cache $cache = $phpbb_container->get('cache'); @@ -93,7 +93,7 @@ class install_update extends module $this->new_location = $phpbb_root_path . 'install/update/new/'; // Init DB - require($phpbb_root_path . 'config.' . $phpEx); + extract($phpbb_config_php_file->get_all()); require($phpbb_root_path . 'includes/constants.' . $phpEx); // Special options for conflicts/modified files @@ -102,7 +102,7 @@ class install_update extends module define('MERGE_NEW_FILE', 3); define('MERGE_MOD_FILE', 4); - $dbms = phpbb_convert_30_dbms_to_31($dbms); + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); $db = new $dbms(); @@ -396,7 +396,7 @@ class install_update extends module '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'])), + 'L_IN_PROGRESS_EXPLAIN' => sprintf($user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files']) + sizeof($this->update_info['deleted'])), )); return; @@ -422,7 +422,7 @@ class install_update extends module // Now assign the list to the template foreach ($update_list as $status => $filelist) { - if ($status == 'no_update' || !sizeof($filelist) || $status == 'status') + if ($status == 'no_update' || !sizeof($filelist) || $status == 'status' || $status == 'status_deleted') { continue; } @@ -489,7 +489,7 @@ class install_update extends module $all_up_to_date = true; foreach ($update_list as $status => $filelist) { - if ($status != 'up_to_date' && $status != 'custom' && $status != 'status' && sizeof($filelist)) + if ($status != 'up_to_date' && $status != 'custom' && $status != 'status' && $status != 'status_deleted' && sizeof($filelist)) { $all_up_to_date = false; break; @@ -831,7 +831,7 @@ class install_update extends module foreach ($update_list as $status => $files) { - if ($status == 'up_to_date' || $status == 'no_update' || $status == 'status') + if ($status == 'up_to_date' || $status == 'no_update' || $status == 'status' || $status == 'status_deleted') { continue; } @@ -1221,6 +1221,16 @@ class install_update extends module $this->page_title = 'VIEWING_FILE_CONTENTS'; break; + + case 'deleted': + + $diff = $this->return_diff(array(), $phpbb_root_path . $original_file); + + $template->assign_var('S_DIFF_NEW_FILE', true); + $diff_mode = 'inline'; + $this->page_title = 'VIEWING_FILE_CONTENTS'; + + break; } $diff_mode_options = ''; @@ -1266,7 +1276,9 @@ class install_update extends module 'new_conflict' => array(), 'conflict' => array(), 'no_update' => array(), + 'deleted' => array(), 'status' => 0, + 'status_deleted'=> 0, ); } @@ -1345,7 +1357,31 @@ class install_update extends module $update_list['status']++; } + foreach ($this->update_info['deleted'] as $index => $file) + { + if (is_int($update_list['status_deleted']) && $index < $update_list['status_deleted']) + { + continue; + } + + if ($num_bytes_processed >= 500 * 1024) + { + return; + } + + if (file_exists($phpbb_root_path . $file)) + { + $update_list['deleted'][] = array('filename' => $file, 'custom' => false, 'as_expected' => false); + $num_bytes_processed += filesize($phpbb_root_path . $file); + } + + $update_list['status_deleted']++; + $update_list['status']++; + } + + $update_list['status_deleted'] = -1; $update_list['status'] = -1; + /* if (!sizeof($this->update_info['files'])) { return $update_list; diff --git a/phpBB/install/phpinfo.php b/phpBB/install/phpinfo.php index 83f154933a..1512b00563 100644 --- a/phpBB/install/phpinfo.php +++ b/phpBB/install/phpinfo.php @@ -1,3 +1,14 @@ <?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ phpinfo(); diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql deleted file mode 100644 index 28649dc54c..0000000000 --- a/phpBB/install/schemas/firebird_schema.sql +++ /dev/null @@ -1,5 +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. diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql deleted file mode 100644 index f88513cf0e..0000000000 --- a/phpBB/install/schemas/mssql_schema.sql +++ /dev/null @@ -1,8 +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. - */ - diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql deleted file mode 100644 index 28649dc54c..0000000000 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ /dev/null @@ -1,5 +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. diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql deleted file mode 100644 index 28649dc54c..0000000000 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ /dev/null @@ -1,5 +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. diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 61f5d5f961..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! diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 3fc8589844..65caba8d1c 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; diff --git a/phpBB/install/schemas/schema.json b/phpBB/install/schemas/schema.json index 79f06693a6..a3ffd923a1 100644 --- a/phpBB/install/schemas/schema.json +++ b/phpBB/install/schemas/schema.json @@ -2088,6 +2088,26 @@ "UINT", 0 ], + "pf_phpbb_skype": [ + "VCHAR", + "" + ], + "pf_phpbb_twitter": [ + "VCHAR", + "" + ], + "pf_phpbb_youtube": [ + "VCHAR", + "" + ], + "pf_phpbb_facebook": [ + "VCHAR", + "" + ], + "pf_phpbb_googleplus": [ + "VCHAR", + "" + ], "pf_phpbb_interests": [ "MTEXT", "" diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 15cd9595c6..9cc151f728 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -273,7 +273,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-b5-dev'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.0-RC3-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'); @@ -806,6 +806,11 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len 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_wlm', 'profilefields.type.string', 'phpbb_wlm', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 7, 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_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'http://edit.yahoo.com/config/send_webmesg?.target=%s&.src=pg'); +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, ''); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql deleted file mode 100644 index 28649dc54c..0000000000 --- a/phpBB/install/schemas/sqlite_schema.sql +++ /dev/null @@ -1,5 +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. diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 638e9907ac..d451bdd515 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -524,8 +524,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.', )); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 8470014161..91fc1215fc 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -225,12 +225,6 @@ $lang = array_merge($lang, array( 'BACK' => 'Back', - '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_OPTION_SHELL' => 'Launch the shell.', - 'COLOUR_SWATCH' => 'Web-safe colour swatch', 'CONFIG_UPDATED' => 'Configuration updated successfully.', 'CRON_LOCK_ERROR' => 'Could not obtain cron lock.', @@ -247,7 +241,7 @@ $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', @@ -310,7 +304,7 @@ $lang = array_merge($lang, array( 'TASKS_NOT_READY' => 'Not ready tasks:', 'TASKS_READY' => 'Ready tasks:', - 'TOTAL_SIZE' => 'Total size', + 'TOTAL_SIZE' => 'Total size', 'UCP' => 'User Control Panel', 'USERNAMES_EXPLAIN' => 'Place each username on a separate line.', @@ -702,7 +696,7 @@ $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>File statistics resynchronised</strong>', diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 6ec722bb78..28cdc8829d 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -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', diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index b4f0f060e9..541d05c255 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -44,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', diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php index 7336031218..67813bcba4 100644 --- a/phpBB/language/en/acp/profile.php +++ b/phpBB/language/en/acp/profile.php @@ -39,9 +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', @@ -91,6 +93,7 @@ $lang = array_merge($lang, array( '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.', diff --git a/phpBB/language/en/acp/search.php b/phpBB/language/en/acp/search.php index f5bec89c2f..564d9dd04c 100644 --- a/phpBB/language/en/acp/search.php +++ b/phpBB/language/en/acp/search.php @@ -60,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:', diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index c2a3f777c2..506d569d56 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -71,8 +71,8 @@ $lang = array_merge($lang, array( 'STYLE_ERR_NAME_EXIST' => 'A style with that name already exists.', 'STYLE_ERR_STYLE_NAME' => 'You must supply a name for this style.', 'STYLE_INSTALLED' => 'Style "%s" has been installed.', - '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_NOT_INSTALLED' => 'Style "%s" was not installed.', 'STYLE_PATH' => 'Style path', diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php new file mode 100644 index 0000000000..eb0f5bb357 --- /dev/null +++ b/phpBB/language/en/cli.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. +* +*/ + +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_MIGRATE' => 'Updates the database by applying migrations.', + '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 on.', + 'CLI_DESCRIPTION_GET_CONFIG' => 'Gets a configuration option’s value', + 'CLI_DESCRIPTION_INCREMENT_CONFIG' => 'Increments a configuration option’s value', + 'CLI_DESCRIPTION_LIST_EXTENSIONS' => 'Lists all extensions in the database and on the filesystem.', + '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_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_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_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Successfully recalculated all email hashes.', +)); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 9a44337294..a58aec43cd 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -64,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', @@ -109,6 +109,7 @@ $lang = array_merge($lang, array( '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_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 %1$d %2$s.', @@ -226,6 +227,7 @@ $lang = array_merge($lang, array( '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', 'FILENAME' => 'Filename', @@ -283,6 +285,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', @@ -296,7 +299,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', ), @@ -390,7 +393,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', @@ -440,29 +443,32 @@ $lang = array_merge($lang, array( // A, B, C and 2 others replied... // A, B, C and others replied... 'NOTIFICATION_BOOKMARK' => array( - 1 => '%1$s replied to the topic “%2$s” you have bookmarked.', + 1 => '<strong>Reply</strong> from %1$s in bookmarked topic:', ), - '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_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_PM' => '<strong>Private Message</strong> from %1$s:', 'NOTIFICATION_POST' => array( - 1 => '%1$s replied to the topic “%2$s”.', + 1 => '<strong>Reply</strong> from %1$s in topic:', ), - '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_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 => '%1$s quoted you in the post “%2$s”.', + 1 => '<strong>Quoted</strong> by %1$s in:', ), - '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.', + '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 newly registered user: “%1$s”', // Used in conjuction with NOTIFICATION_BOOKMARK and NOTIFICATION_POST. 'NOTIFICATION_MANY_OTHERS' => 'others', 'NOTIFICATION_X_OTHERS' => array( @@ -558,6 +564,7 @@ $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.', @@ -588,6 +595,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', @@ -654,15 +663,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', @@ -676,6 +685,7 @@ $lang = array_merge($lang, array( '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_VIEW_ATTACH' => 'You are not authorised to download this attachment.', @@ -771,6 +781,7 @@ $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. Please verify that the URL you entered is correct.', 'UNABLE_TO_DELIVER_FILE'=> 'Unable to deliver file.', @@ -810,6 +821,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', @@ -857,6 +869,7 @@ $lang = array_merge($lang, array( 'WROTE' => 'wrote', 'YAHOO' => 'Yahoo Messenger', + 'YOUTUBE' => 'YouTube', 'YEAR' => 'Year', 'YEAR_MONTH_DAY' => '(YYYY-MM-DD)', 'YES' => 'Yes', diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index 102dffcd5b..904dc92080 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -121,7 +121,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?', @@ -153,7 +153,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?', @@ -254,7 +254,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!', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 7235e51a94..a2b27f0a60 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -142,7 +142,6 @@ $lang = array_merge($lang, array( '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', @@ -171,8 +170,6 @@ $lang = array_merge($lang, array( '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.', @@ -216,7 +213,6 @@ $lang = array_merge($lang, array( <li>PostgreSQL 8.3+</li> <li>SQLite 2.8.2+</li> <li>SQLite 3.6.15+</li> - <li>Firebird 2.1+</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> @@ -241,8 +237,6 @@ $lang = array_merge($lang, array( '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_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.', @@ -297,8 +291,8 @@ $lang = array_merge($lang, array( '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_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', @@ -351,7 +345,7 @@ $lang = array_merge($lang, array( '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 />', + '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/documentation/3.1/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.', @@ -433,6 +427,8 @@ $lang = array_merge($lang, array( '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', @@ -503,6 +499,7 @@ $lang = array_merge($lang, array( 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', 'SELECT_FTP_SETTINGS' => 'Select FTP settings', 'SHOW_DIFF_CONFLICT' => 'Show differences/conflicts', + 'SHOW_DIFF_DELETED' => 'Show file contents', 'SHOW_DIFF_FINAL' => 'Show resulting file', 'SHOW_DIFF_MODIFIED' => 'Show merged differences', 'SHOW_DIFF_NEW' => 'Show file contents', @@ -516,6 +513,7 @@ $lang = array_merge($lang, array( 'STAGE_UPDATE_FILES' => 'Update files', 'STAGE_VERSION_CHECK' => 'Version check', 'STATUS_CONFLICT' => 'Modified file producing conflicts', + 'STATUS_DELETED' => 'Deleted file', 'STATUS_MODIFIED' => 'Modified file', 'STATUS_NEW' => 'New file', 'STATUS_NEW_CONFLICT' => 'Conflicting new file', diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index d900ababd1..1a05975892 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -49,7 +49,6 @@ $lang = array_merge($lang, array( 'BEFORE' => 'Before', 'CC_EMAIL' => 'Send a copy of this email to yourself.', - 'CONTACT_USER' => 'Contact', 'CONTACT_ADMIN' => 'Contact a Board Administrator', 'DEST_LANG' => 'Language', @@ -144,4 +143,9 @@ $lang = array_merge($lang, array( 'USERS_PER_PAGE' => 'Users per page', 'VIEWING_PROFILE' => 'Viewing profile - %s', + '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/plupload.php b/phpBB/language/en/plupload.php index c4a8d770a0..15c3955a1a 100644 --- a/phpBB/language/en/plupload.php +++ b/phpBB/language/en/plupload.php @@ -3,8 +3,8 @@ * * This file is part of the phpBB Forum Software package. * -* @copyright (c) 2010-2013 Moxiecode Systems AB * @copyright (c) phpBB Limited <https://www.phpbb.com> +* @copyright (c) 2010-2013 Moxiecode Systems AB * @license GNU General Public License, version 2 (GPL-2.0) * * For full copyright and license information, please see diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 20377287fd..2cd6ec59cc 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -60,7 +60,7 @@ $lang = array_merge($lang, array( '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', @@ -225,6 +225,7 @@ $lang = array_merge($lang, array( ), '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', @@ -256,6 +257,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.', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index c3ace160e9..d692828bd7 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -40,7 +40,7 @@ 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 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, the phpBB Limited 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. ', @@ -209,7 +209,9 @@ $lang = array_merge($lang, array( '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_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_DATE' => 'The field “%s” has an invalid date.', @@ -326,12 +328,12 @@ $lang = array_merge($lang, array( '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_TOPIC' => 'Someone creates a topic in a forum to which you are subscribed', 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER' => 'Newly registered user requiring activation', 'NOTIFY_METHOD' => 'Notification method', @@ -357,6 +359,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.', diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 9354eef8fd..25765b1af7 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -19,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 @@ -117,7 +118,7 @@ if (!$auth->acl_getf_global('m_')) $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; @@ -299,649 +300,3 @@ $template->assign_vars(array( // Generate the page, do not display/query online list $module->display($module->get_page_title()); - -/** -* 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') ? 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 = 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; -} diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 4eb6d79272..4f4dcb1b41 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -640,7 +640,7 @@ switch ($mode) ); extract($phpbb_dispatcher->trigger_event('core.memberlist_view_profile', compact($vars))); - $template->assign_vars(show_profile($member, $user_notes_enabled, $warn_user_enabled)); + $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')) @@ -799,7 +799,7 @@ switch ($mode) $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->any_char); + 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(); @@ -829,8 +829,14 @@ switch ($mode) $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'], 'k' => $user->lang['JABBER']); - $sort_key_sql = array('a' => 'u.username_clean', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', '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')) { @@ -920,9 +926,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 .= ($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) @@ -1016,12 +1022,12 @@ switch ($mode) { 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 @@ -1286,6 +1292,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, @@ -1400,7 +1407,7 @@ 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'); } for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i) @@ -1416,7 +1423,7 @@ switch ($mode) $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$user_id], false) : array(); } - $memberrow = array_merge(show_profile($row), array( + $memberrow = array_merge(phpbb_show_profile($row), array( 'ROW_NUMBER' => $i + ($start + 1), 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, @@ -1485,166 +1492,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_active = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit']; - } - else - { - $last_active = ''; - } - - $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')) - { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - } - - // Can this user receive a Private Message? - $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' => $rank_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' => $rank_img, - 'RANK_IMG_SRC' => $rank_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' => $data['user_jabber'], - 'USER_JABBER_IMG' => ($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; -} - -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/auth/auth.php b/phpBB/phpbb/auth/auth.php index 20c60364d8..38755ccf99 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -208,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) { @@ -1043,7 +1046,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 { @@ -1074,7 +1077,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 4f44efe9af..9137a77210 100644 --- a/phpBB/phpbb/auth/provider/apache.php +++ b/phpBB/phpbb/auth/provider/apache.php @@ -28,13 +28,13 @@ class apache extends \phpbb\auth\provider\base /** * Apache Authentication Constructor * - * @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 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_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext) { diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php index e7764b754b..d32e7504eb 100644 --- a/phpBB/phpbb/auth/provider/ldap.php +++ b/phpBB/phpbb/auth/provider/ldap.php @@ -29,10 +29,10 @@ class ldap extends \phpbb\auth\provider\base /** * LDAP Authentication Constructor * - * @param \phpbb\db\driver\driver_interface $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_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\user $user) { diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php index fe1a376cfe..023cf402ca 100644 --- a/phpBB/phpbb/auth/provider/oauth/token_storage.php +++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php @@ -266,7 +266,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'); } diff --git a/phpBB/phpbb/auth/provider_collection.php b/phpBB/phpbb/auth/provider_collection.php index fe32a34e12..a74a2135dc 100644 --- a/phpBB/phpbb/auth/provider_collection.php +++ b/phpBB/phpbb/auth/provider_collection.php @@ -29,7 +29,7 @@ class provider_collection extends \phpbb\di\service_collection * @param ContainerInterface $container Container object * @param \phpbb\config\config $config phpBB config */ - public function __construct($container, \phpbb\config\config $config) + public function __construct(ContainerInterface $container, \phpbb\config\config $config) { $this->container = $container; $this->config = $config; diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index c43004f340..edc5941602 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -19,6 +19,32 @@ namespace phpbb\avatar\driver; class upload extends \phpbb\avatar\driver\driver { /** + * @var \phpbb\mimetype\guesser + */ + protected $mimetype_guesser; + + /** + * Construct a driver object + * + * @param \phpbb\config\config $config phpBB configuration + * @param \phpbb\request\request $request Request object + * @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\mimetype\guesser $mimetype_guesser Mimetype guesser + * @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\mimetype\guesser $mimetype_guesser, \phpbb\cache\driver\driver_interface $cache = null) + { + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->path_helper = $path_helper; + $this->mimetype_guesser = $mimetype_guesser; + $this->cache = $cache; + } + + /** * {@inheritdoc} */ public function get_data($row, $ignore_config = false) @@ -70,7 +96,7 @@ class upload extends \phpbb\avatar\driver\driver if (!empty($upload_file['name'])) { - $file = $upload->form_upload('avatar_upload_file'); + $file = $upload->form_upload('avatar_upload_file', $this->mimetype_guesser); } else if (!empty($this->config['allow_avatar_remote_upload']) && !empty($url)) { @@ -100,7 +126,7 @@ class upload extends \phpbb\avatar\driver\driver return false; } - $file = $upload->remote_upload($url); + $file = $upload->remote_upload($url, $this->mimetype_guesser); } else { diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index b32af32d25..2d538b739c 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -208,7 +208,7 @@ class file extends \phpbb\cache\driver\base { $iterator = new \DirectoryIterator($this->cache_dir); } - catch (Exception $e) + catch (\Exception $e) { return; } @@ -259,7 +259,7 @@ class file extends \phpbb\cache\driver\base { $iterator = new \DirectoryIterator($dir); } - catch (Exception $e) + catch (\Exception $e) { return; } diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index c9aa6525c0..56727c2ad5 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -47,7 +47,7 @@ class service protected $phpbb_root_path; /** - * PHP extension. + * PHP file extension. * * @var string */ @@ -60,7 +60,7 @@ class service * @param \phpbb\config\config $config The config * @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_interface $db, $phpbb_root_path, $php_ext) { @@ -168,18 +168,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); @@ -305,7 +299,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': @@ -316,13 +310,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/composer.json b/phpBB/phpbb/composer.json new file mode 100644 index 0000000000..513d7e4559 --- /dev/null +++ b/phpBB/phpbb/composer.json @@ -0,0 +1,27 @@ +{ + "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.3.3" + } +} diff --git a/phpBB/phpbb/config_php_file.php b/phpBB/phpbb/config_php_file.php new file mode 100644 index 0000000000..1a562e470d --- /dev/null +++ b/phpBB/phpbb/config_php_file.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; + +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 bool|array Return the content of the config file or false if the file does not exists. + */ + public function get_all() + { + if (!$this->load_config_file()) + { + return false; + } + + return $this->config_data; + } + + /** + * Return the value of a variable defined into the config.php file and false if the variable does not exist. + * + * @param string $variable The name of the variable + * @return mixed + */ + public function get($variable) + { + if (!$this->load_config_file()) + { + return false; + } + + return isset($this->config_data[$variable]) ? $this->config_data[$variable] : false; + } + + /** + * Load the config file and store the information. + * + * @return bool True if the file was correctly loaded, false otherwise. + */ + protected function load_config_file() + { + if (!$this->config_loaded) + { + if (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; + } + else + { + return false; + } + } + + return 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 b1f0635913..bc4897af18 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -17,7 +17,6 @@ use Symfony\Component\Console\Shell; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\DependencyInjection\TaggedContainerInterface; class application extends \Symfony\Component\Console\Application { @@ -38,9 +37,26 @@ class application extends \Symfony\Component\Console\Application */ public function __construct($name, $version, \phpbb\user $user) { + $this->user = $user; + parent::__construct($name, $version); + } - $this->user = $user; + /** + * {@inheritdoc} + */ + protected function getDefaultInputDefinition() + { + $input_definition = parent::getDefaultInputDefinition(); + + $input_definition->addOption(new InputOption( + 'safe-mode', + null, + InputOption::VALUE_NONE, + $this->user->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE') + )); + + return $input_definition; } /** @@ -73,14 +89,13 @@ class application extends \Symfony\Component\Console\Application /** * Register a set of commands from the container * - * @param TaggedContainerInterface $container The container - * @param string $tag The tag used to register the commands + * @param \phpbb\di\service_collection $command_collection The console service collection */ - public function register_container_commands(TaggedContainerInterface $container, $tag = 'console.command') + public function register_container_commands(\phpbb\di\service_collection $command_collection) { - foreach($container->findTaggedServiceIds($tag) as $id => $void) + foreach ($command_collection as $service_command) { - $this->add($container->get($id)); + $this->add($service_command); } } diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 379d2aa1ca..ec8229200c 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -29,31 +29,27 @@ class purge extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - /** @var \phpbb\user */ - protected $user; - /** @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\user $user User instance * @param \phpbb\config\config $config Config instance */ - public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user, \phpbb\config\config $config) + 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 $log, \phpbb\config\config $config) { $this->cache = $cache; $this->db = $db; $this->auth = $auth; $this->log = $log; - $this->user = $user; $this->config = $config; - parent::__construct(); + parent::__construct($user); } /** @@ -63,7 +59,7 @@ class purge extends \phpbb\console\command\command { $this ->setName('cache:purge') - ->setDescription('Purge the cache.') + ->setDescription($this->user->lang('PURGE_CACHE')) ; } diff --git a/phpBB/phpbb/console/command/command.php b/phpBB/phpbb/console/command/command.php index d3449c0c38..638c989da2 100644 --- a/phpBB/phpbb/console/command/command.php +++ b/phpBB/phpbb/console/command/command.php @@ -15,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 de3fbd7fa7..f0ad5d4d19 100644 --- a/phpBB/phpbb/console/command/config/command.php +++ b/phpBB/phpbb/console/command/config/command.php @@ -17,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 1310bb18b4..efd276d7e3 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -25,11 +25,11 @@ class delete extends command { $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') ) ; } @@ -53,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 ee8c65110e..9c03b49a3d 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -26,17 +26,17 @@ class get extends command { $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') ) ; } @@ -66,7 +66,7 @@ class get extends command } 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 21f0660e61..b4d7438b66 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -26,22 +26,22 @@ class increment extends command { $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') ) ; } @@ -65,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 587b7fb0de..695de31013 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -26,22 +26,22 @@ class set extends command { $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') ) ; } @@ -65,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 a7a52155f9..e8c69a0885 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -26,27 +26,27 @@ class set_atomic extends command { $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') ) ; } @@ -72,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 index 4f4228d9b3..c515fd9e80 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -20,20 +20,16 @@ class cron_list extends \phpbb\console\command\command /** @var \phpbb\cron\manager */ protected $cron_manager; - /** @var \phpbb\user */ - protected $user; - /** * Constructor * - * @param \phpbb\cron\manager $cron_manager Cron manager * @param \phpbb\user $user User instance + * @param \phpbb\cron\manager $cron_manager Cron manager */ - public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\user $user) + public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager) { $this->cron_manager = $cron_manager; - $this->user = $user; - parent::__construct(); + parent::__construct($user); } /** diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 32774bebe4..72ad1205ef 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -3,7 +3,7 @@ * * This file is part of the phpBB Forum Software package. * -* @copyright (c) phpBB Limited +* @copyright (c) phpBB Limited <https://www.phpbb.com> * @license GNU General Public License, version 2 (GPL-2.0) * * For full copyright and license information, please see @@ -25,23 +25,19 @@ class run extends \phpbb\console\command\command /** @var \phpbb\lock\db */ protected $lock_db; - /** @var \phpbb\user */ - protected $user; - /** * 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. - * @param \phpbb\user $user The user object (used to get language information) */ - public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db, \phpbb\user $user) + 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; - $this->user = $user; - parent::__construct(); + parent::__construct($user); } /** diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 2abeaf5268..c3caae5f70 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -32,31 +32,29 @@ class migrate extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - /** @var \phpbb\user */ - protected $user; - - function __construct(\phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\user $user) + function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log) { $this->migrator = $migrator; $this->extension_manager = $extension_manager; $this->config = $config; $this->cache = $cache; $this->log = $log; - $this->user = $user; + parent::__construct($user); $this->user->add_lang(array('common', 'install', 'migrator')); - parent::__construct(); } protected function configure() { $this ->setName('db:migrate') - ->setDescription('Updates the database by applying migrations.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE')) ; } protected function execute(InputInterface $input, OutputInterface $output) { + $this->migrator->create_migrations_table(); + $this->load_migrations(); $orig_version = $this->config['version']; while (!$this->migrator->finished()) diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php index c2f61568ea..f9047bdac8 100644 --- a/phpBB/phpbb/console/command/dev/migration_tips.php +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -20,17 +20,17 @@ class migration_tips extends \phpbb\console\command\command /** @var \phpbb\extension\manager */ protected $extension_manager; - function __construct(\phpbb\extension\manager $extension_manager) + function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager) { $this->extension_manager = $extension_manager; - parent::__construct(); + parent::__construct($user); } protected function configure() { $this ->setName('dev:migration-tips') - ->setDescription('Finds migrations that are not depended on.') + ->setDescription($this->user->lang('CLI_DESCRIPTION_FIND_MIGRATIONS')) ; } diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php index 21bb640504..364d954082 100644 --- a/phpBB/phpbb/console/command/extension/command.php +++ b/phpBB/phpbb/console/command/extension/command.php @@ -20,11 +20,11 @@ abstract class command extends \phpbb\console\command\command /** @var \phpbb\log\log */ protected $log; - public function __construct(\phpbb\extension\manager $manager, \phpbb\log\log $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 5f0e74b984..1eee16cbd9 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -22,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') ) ; } @@ -37,15 +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 { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name)); - $output->writeln("<info>Successfully disabled extension $name</info>"); + $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 0cdf26d4db..59ff11e9b7 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -22,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') ) ; } @@ -37,15 +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)) { - $this->log->add('admin', ANONYMOUS, '', 'LOG_EXTENSION_ENABLE', time(), array($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 4e57641d83..517e9a74c9 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -22,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') ) ; } @@ -37,15 +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 { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name)); - $output->writeln("<info>Successfully purge extension $name</info>"); + $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 2db1c59e24..6ce9607098 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -21,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')) ; } @@ -32,7 +32,7 @@ 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; } diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index ec04da4267..ec4e1b0ee7 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -20,18 +20,18 @@ class recalculate_email_hash extends \phpbb\console\command\command /** @var \phpbb\db\driver\driver_interface */ protected $db; - function __construct(\phpbb\db\driver\driver_interface $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')) ; } @@ -70,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/controller/helper.php b/phpBB/phpbb/controller/helper.php index 930bc42a98..dd89d0504a 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -40,6 +40,9 @@ class helper */ protected $config; + /* @var \phpbb\symfony_request */ + protected $symfony_request; + /** * phpBB root path * @var string @@ -47,7 +50,7 @@ class helper protected $phpbb_root_path; /** - * PHP extension + * PHP file extension * @var string */ protected $php_ext; @@ -60,14 +63,16 @@ class helper * @param \phpbb\config\config $config Config object * @param \phpbb\controller\provider $provider Path provider * @param \phpbb\extension\manager $manager Extension manager object + * @param \phpbb\symfony_request $symfony_request Symfony Request object * @param string $phpbb_root_path phpBB root path - * @param string $php_ext PHP extension + * @param string $php_ext PHP file extension */ - public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, $phpbb_root_path, $php_ext) { $this->template = $template; $this->user = $user; $this->config = $config; + $this->symfony_request = $symfony_request; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $provider->find_routing_files($manager->get_finder()); @@ -77,9 +82,11 @@ class 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 + * * @return Response object containing rendered page */ public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false) @@ -151,4 +158,14 @@ class helper return $this->render('message_body.html', $this->user->lang('INFORMATION'), $code); } + + /** + * Return the current url + * + * @return string + */ + public function get_current_url() + { + return generate_board_url(true) . $this->symfony_request->getRequestUri(); + } } diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php index b0601e641a..5c8ac04b77 100644 --- a/phpBB/phpbb/cron/manager.php +++ b/phpBB/phpbb/cron/manager.php @@ -35,6 +35,8 @@ class manager * Constructor. Loads all available tasks. * * @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) { diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php index 032ba1d2cc..b47939ccbe 100644 --- a/phpBB/phpbb/cron/task/core/prune_all_forums.php +++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php @@ -31,7 +31,7 @@ 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_interface $db The db connection */ diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php index 8da0048baa..ba68565197 100644 --- a/phpBB/phpbb/cron/task/core/prune_forum.php +++ b/phpBB/phpbb/cron/task/core/prune_forum.php @@ -41,7 +41,7 @@ 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_interface $db The db connection */ diff --git a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php index 381483c798..97a4b0ea86 100644 --- a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php +++ b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php @@ -43,13 +43,13 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t * 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 * @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 $db, \phpbb\log\log $log, \phpbb\user $user) + 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; diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php index 553e424bd0..796a96d7f5 100644 --- a/phpBB/phpbb/cron/task/core/queue.php +++ b/phpBB/phpbb/cron/task/core/queue.php @@ -26,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) diff --git a/phpBB/phpbb/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php index ec058b4a50..949bba8012 100644 --- a/phpBB/phpbb/cron/task/core/tidy_database.php +++ b/phpBB/phpbb/cron/task/core/tidy_database.php @@ -26,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_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php index 2de744b7c1..ce16b3f988 100644 --- a/phpBB/phpbb/cron/task/core/tidy_search.php +++ b/phpBB/phpbb/cron/task/core/tidy_search.php @@ -31,7 +31,7 @@ class tidy_search 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\auth\auth $auth The auth * @param \phpbb\config\config $config The config * @param \phpbb\db\driver\driver_interface $db The db connection @@ -54,8 +54,7 @@ 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; @@ -78,10 +77,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_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php index 058288222c..7b67eae6ef 100644 --- a/phpBB/phpbb/cron/task/core/tidy_warnings.php +++ b/phpBB/phpbb/cron/task/core/tidy_warnings.php @@ -28,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/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php index 11399282d3..8a4a8b1f0c 100644 --- a/phpBB/phpbb/cron/task/wrapper.php +++ b/phpBB/phpbb/cron/task/wrapper.php @@ -29,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 9c9292a8e4..e674707883 100644 --- a/phpBB/phpbb/datetime.php +++ b/phpBB/phpbb/datetime.php @@ -38,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. */ public function __construct($user, $time = 'now', \DateTimeZone $timezone = null) { diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 3d4aa95606..3e9110d8bc 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -87,6 +87,102 @@ abstract class driver implements driver_interface } /** + * {@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) diff --git a/phpBB/phpbb/db/driver/driver_interface.php b/phpBB/phpbb/db/driver/driver_interface.php index 7f7d341e2d..6722d059a5 100644 --- a/phpBB/phpbb/db/driver/driver_interface.php +++ b/phpBB/phpbb/db/driver/driver_interface.php @@ -16,6 +16,90 @@ 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 diff --git a/phpBB/phpbb/db/driver/factory.php b/phpBB/phpbb/db/driver/factory.php new file mode 100644 index 0000000000..f0fa18051b --- /dev/null +++ b/phpBB/phpbb/db/driver/factory.php @@ -0,0 +1,435 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license 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_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 c7b185a577..0000000000 --- a/phpBB/phpbb/db/driver/firebird.php +++ /dev/null @@ -1,526 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.com> -* @license 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; - -/** -* Firebird/Interbase Database Abstraction Layer -* Minimum Requirement is Firebird 2.1 -*/ -class firebird extends \phpbb\db\driver\driver -{ - var $last_query_text = ''; - var $service_handle = false; - var $affected_rows = 0; - var $connect_error = ''; - - /** - * {@inheritDoc} - */ - 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(''); - } - - /** - * {@inheritDoc} - */ - 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; - } - - /** - * {@inheritDoc} - */ - 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); - } - - /** - * {@inheritDoc} - */ - 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; - } - } - - /** - * {@inheritDoc} - */ - 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; - } - - /** - * {@inheritDoc} - */ - 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; - } - - /** - * {@inheritDoc} - */ - 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; - } - - /** - * {@inheritDoc} - */ - 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 2e56638617..268463a151 100644 --- a/phpBB/phpbb/db/driver/mssql.php +++ b/phpBB/phpbb/db/driver/mssql.php @@ -137,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); @@ -152,6 +156,10 @@ 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 ($cache && $cache_ttl) { diff --git a/phpBB/phpbb/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php index de90d878e7..8e5d4c7a4c 100644 --- a/phpBB/phpbb/db/driver/mssql_odbc.php +++ b/phpBB/phpbb/db/driver/mssql_odbc.php @@ -156,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; @@ -172,6 +176,10 @@ 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 ($cache && $cache_ttl) { diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index a7f93c8feb..46a9b3a477 100644 --- a/phpBB/phpbb/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php @@ -127,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; @@ -145,6 +149,10 @@ 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 ($cache && $cache_ttl) { diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php index 569bd4f10a..e93c7239e8 100644 --- a/phpBB/phpbb/db/driver/mysql.php +++ b/phpBB/phpbb/db/driver/mysql.php @@ -166,6 +166,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); @@ -181,6 +185,10 @@ 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 ($cache && $cache_ttl) { diff --git a/phpBB/phpbb/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php index 58361ff0f8..2ed08211ad 100644 --- a/phpBB/phpbb/db/driver/mysqli.php +++ b/phpBB/phpbb/db/driver/mysqli.php @@ -61,7 +61,11 @@ class mysqli extends \phpbb\db\driver\mysql_base } $this->db_connect_id = mysqli_init(); - @mysqli_real_connect($this->db_connect_id, $this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket, MYSQLI_CLIENT_FOUND_ROWS); + + 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 != '') { @@ -71,10 +75,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 !== null) + { + $row = @mysqli_fetch_assoc($result); - $modes = array_map('trim', explode(',', $row['sql_mode'])); + $modes = array_map('trim', explode(',', $row['sql_mode'])); + } + else + { + $modes = array(); + } + @mysqli_free_result($result); // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES if (!in_array('TRADITIONAL', $modes)) @@ -109,15 +120,18 @@ 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 !== null) + { + $row = @mysqli_fetch_assoc($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); + } } + @mysqli_free_result($result); } return ($raw) ? $this->sql_server_version : 'MySQL(i) ' . $this->sql_server_version; @@ -165,6 +179,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); @@ -180,6 +198,10 @@ 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 ($cache && $cache_ttl) { @@ -224,7 +246,7 @@ class mysqli extends \phpbb\db\driver\mysql_base return $cache->sql_fetchrow($query_id); } - if ($query_id !== false) + if ($query_id !== false && $query_id !== null) { $result = @mysqli_fetch_assoc($query_id); return $result !== null ? $result : false; @@ -434,9 +456,12 @@ 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 !== null) { - // 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); diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php index bfc5373e35..d1a186f1ba 100644 --- a/phpBB/phpbb/db/driver/oracle.php +++ b/phpBB/phpbb/db/driver/oracle.php @@ -253,6 +253,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; @@ -430,6 +434,10 @@ 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 ($cache && $cache_ttl) { diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index a4aa9497ed..83e9fa51f6 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -15,10 +15,11 @@ namespace phpbb\db\driver; /** * PostgreSQL Database Abstraction Layer -* Minimum Requirement is Version 7.3+ +* Minimum Requirement is Version 8.3+ */ class postgres extends \phpbb\db\driver\driver { + var $multi_insert = true; var $last_query_text = ''; var $connect_error = ''; @@ -101,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); @@ -179,6 +175,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; @@ -195,6 +195,10 @@ 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 ($cache && $cache_ttl) { diff --git a/phpBB/phpbb/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php index f4c5e240fc..2112e5ba2f 100644 --- a/phpBB/phpbb/db/driver/sqlite.php +++ b/phpBB/phpbb/db/driver/sqlite.php @@ -121,6 +121,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); @@ -136,6 +140,10 @@ 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) { diff --git a/phpBB/phpbb/db/driver/sqlite3.php b/phpBB/phpbb/db/driver/sqlite3.php index 2c6bf99497..0922229e0a 100644 --- a/phpBB/phpbb/db/driver/sqlite3.php +++ b/phpBB/phpbb/db/driver/sqlite3.php @@ -50,9 +50,10 @@ class sqlite3 extends \phpbb\db\driver\driver $this->dbo = new \SQLite3($this->server, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE); $this->db_connect_id = true; } - catch (Exception $e) + catch (\Exception $e) { - return array('message' => $e->getMessage()); + $this->connect_error = $e->getMessage(); + return array('message' => $this->connect_error); } return true; @@ -121,6 +122,10 @@ class sqlite3 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; @@ -137,6 +142,10 @@ class sqlite3 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) { @@ -272,7 +281,7 @@ class sqlite3 extends \phpbb\db\driver\driver */ protected function _sql_error() { - if (class_exists('SQLite3', false)) + if (class_exists('SQLite3', false) && isset($this->dbo)) { $error = array( 'message' => $this->dbo->lastErrorMsg(), 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 139dc95b28..648ae9ce96 100644 --- a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php +++ b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php @@ -37,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_4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php index db3c587f82..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 @@ -36,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_7_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php index d86c4d6986..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 @@ -76,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_9_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php index 24340c8cf1..06e46d522f 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 @@ -89,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/v310/contact_admin_acp_module.php b/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php index bd682e2f7c..20bd547ac3 100644 --- a/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php +++ b/phpBB/phpbb/db/migration/data/v310/contact_admin_acp_module.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @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/phpBB/phpbb/db/migration/data/v310/contact_admin_form.php b/phpBB/phpbb/db/migration/data/v310/contact_admin_form.php index e255efb99d..c2dd09ddf6 100644 --- a/phpBB/phpbb/db/migration/data/v310/contact_admin_form.php +++ b/phpBB/phpbb/db/migration/data/v310/contact_admin_form.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @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/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php index df1560f5b1..4530ebe285 100644 --- a/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php +++ b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php @@ -18,7 +18,7 @@ class mysql_fulltext_drop extends \phpbb\db\migration\migration public function effectively_installed() { // This migration is irrelevant for all non-MySQL DBMSes. - return strpos($this->db->sql_layer, 'mysql') === false; + return strpos($this->db->get_sql_layer(), 'mysql') === false; } static public function depends_on() diff --git a/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php b/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php index ca784656e7..ea442dfb1b 100644 --- a/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php +++ b/phpBB/phpbb/db/migration/data/v310/postgres_fulltext_drop.php @@ -18,7 +18,7 @@ class postgres_fulltext_drop extends \phpbb\db\migration\migration public function effectively_installed() { // This migration is irrelevant for all non-PostgreSQL DBMSes. - return strpos($this->db->sql_layer, 'postgres') === false; + return strpos($this->db->get_sql_layer(), 'postgres') === false; } static public function depends_on() 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..5964e7a997 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_facebook.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\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_types', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + ); + } + + 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_googleplus.php b/phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.php new file mode 100644 index 0000000000..9bef0a4c0b --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.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\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_types', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + ); + } + + 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_skype.php b/phpBB/phpbb/db/migration/data/v310/profilefield_skype.php new file mode 100644 index 0000000000..9a5de9d0eb --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_skype.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\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_types', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + ); + } + + 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..68d038f609 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.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\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_types', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + ); + } + + 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_youtube.php b/phpBB/phpbb/db/migration/data/v310/profilefield_youtube.php new file mode 100644 index 0000000000..bb90c0aa5c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_youtube.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\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_types', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + ); + } + + 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/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/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/migration.php b/phpBB/phpbb/db/migration/migration.php index fdfc31da3a..5f120333e1 100644 --- a/phpBB/phpbb/db/migration/migration.php +++ b/phpBB/phpbb/db/migration/migration.php @@ -160,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 9cdd5d0927..9000949a7d 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -21,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() @@ -58,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 @@ -79,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' => '', )); @@ -95,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 */ 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/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index d2df27613a..5cfbc5ca00 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -105,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) @@ -243,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 = '') diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index c2f7b5ab23..8bc63e564a 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -110,7 +110,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)) { @@ -767,4 +767,28 @@ class migrator return $this->migrations; } + + /** + * Creates the migrations table if it does not exist. + * @return null + */ + public function create_migrations_table() + { + // Make sure migrations have been installed. + if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations')) + { + $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', + )); + } + } } diff --git a/phpBB/phpbb/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php index 6b6f556571..14e3c54f09 100644 --- a/phpBB/phpbb/db/sql_insert_buffer.php +++ b/phpBB/phpbb/db/sql_insert_buffer.php @@ -92,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(); } diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index 2ee842eace..ae0c695aa2 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -109,36 +109,6 @@ class tools 'VARBINARY' => 'varbinary(255)', ), - 'firebird' => array( - 'INT:' => 'INTEGER', - 'BINT' => 'DOUBLE PRECISION', - '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]', @@ -331,7 +301,7 @@ class tools * 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', 'sqlite3'); + var $supported_dbms = array('mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite', 'sqlite3'); /** * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). @@ -353,7 +323,7 @@ class tools $this->dbms_type_map = self::get_dbms_type_map(); // Determine mapping database type - switch ($this->db->sql_layer) + switch ($this->db->get_sql_layer()) { case 'mysql': $this->sql_layer = 'mysql_40'; @@ -384,7 +354,7 @@ class tools break; default: - $this->sql_layer = $this->db->sql_layer; + $this->sql_layer = $this->db->get_sql_layer(); break; } } @@ -407,7 +377,7 @@ class tools */ function sql_list_tables() { - switch ($this->db->sql_layer) + switch ($this->db->get_sql_layer()) { case 'mysql': case 'mysql4': @@ -441,13 +411,6 @@ class tools 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'; @@ -580,7 +543,6 @@ class tools // Close the table for two DBMS and add to the statements switch ($this->sql_layer) { - case 'firebird': case 'mssql': case 'mssqlnative': $table_sql .= "\n);"; @@ -610,7 +572,6 @@ class tools $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; break; - case 'firebird': case 'mssql': case 'mssqlnative': // We need the data here @@ -685,19 +646,6 @@ class tools $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 @@ -763,7 +711,7 @@ class tools $sqlite = false; // For SQLite we need to perform the schema changes in a much more different way - if (($this->db->sql_layer == 'sqlite' || $this->db->sql_layer == 'sqlite3') && $this->return_statements) + if (($this->db->get_sql_layer() == 'sqlite' || $this->db->get_sql_layer() == 'sqlite3') && $this->return_statements) { $sqlite_data = array(); $sqlite = true; @@ -1174,12 +1122,6 @@ class tools 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': case 'sqlite3': $sql = "SELECT sql @@ -1278,15 +1220,6 @@ class tools 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 @@ -1332,7 +1265,6 @@ class tools // These DBMS prefix index name with the table name switch ($this->sql_layer) { - case 'firebird': case 'oracle': case 'postgres': case 'sqlite': @@ -1385,15 +1317,6 @@ class tools 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 @@ -1460,7 +1383,6 @@ class tools } break; - case 'firebird': case 'postgres': case 'sqlite': case 'sqlite3': @@ -1536,32 +1458,6 @@ class tools 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} "; @@ -1591,8 +1487,16 @@ class tools $return_array['textimage'] = $column_type === '[text]'; - $sql .= 'NOT NULL'; - $sql_default .= 'NOT NULL'; + 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; @@ -1607,7 +1511,15 @@ class tools { $sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; } - $sql .= 'NOT NULL'; + + if (!is_null($column_data[1])) + { + $sql .= 'NOT NULL'; + } + else + { + $sql .= 'NULL'; + } if (isset($column_data[2])) { @@ -1632,7 +1544,7 @@ class tools // 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'; + $sql .= ($column_data[1] === '' || $column_data[1] === null) ? '' : 'NOT NULL'; } $return_array['auto_increment'] = false; @@ -1660,6 +1572,12 @@ class tools $return_array['null'] = 'NOT NULL'; $sql .= 'NOT NULL '; } + else + { + $default_val = "'" . $column_data[1] . "'"; + $return_array['null'] = 'NULL'; + $sql .= 'NULL '; + } $return_array['default'] = $default_val; @@ -1692,8 +1610,11 @@ class tools $sql .= ' ' . $column_type; } - $sql .= ' NOT NULL '; - $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; + if (!is_null($column_data[1])) + { + $sql .= ' NOT NULL '; + $sql .= "DEFAULT '{$column_data[1]}'"; + } break; } @@ -1772,11 +1693,6 @@ class tools 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 @@ -1894,10 +1810,6 @@ class tools switch ($this->sql_layer) { - case 'firebird': - $statements[] = 'ALTER TABLE ' . $table_name . ' DROP "' . strtoupper($column_name) . '"'; - break; - case 'mssql': case 'mssqlnative': // We need the data here @@ -2036,7 +1948,6 @@ class tools $statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name; break; - case 'firebird': case 'oracle': case 'postgres': case 'sqlite': @@ -2065,21 +1976,6 @@ class tools 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 @@ -2125,7 +2021,6 @@ class tools switch ($this->sql_layer) { - case 'firebird': case 'postgres': case 'mysql_40': case 'mysql_41': @@ -2217,7 +2112,6 @@ class tools switch ($this->sql_layer) { - case 'firebird': case 'postgres': case 'oracle': case 'sqlite': @@ -2261,7 +2155,6 @@ class tools switch ($this->sql_layer) { - case 'firebird': case 'postgres': case 'oracle': case 'sqlite': @@ -2320,15 +2213,6 @@ class tools { 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 @@ -2373,7 +2257,6 @@ class tools switch ($this->sql_layer) { - case 'firebird': case 'oracle': case 'postgres': case 'sqlite': @@ -2400,20 +2283,6 @@ class tools 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': // We need the data here diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php new file mode 100644 index 0000000000..553b723cc8 --- /dev/null +++ b/phpBB/phpbb/di/container_builder.php @@ -0,0 +1,402 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license 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\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\PhpDumper; + +class container_builder +{ + /** @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; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $dbal_connection = null; + + /** + * @var array the installed extensions + */ + protected $installed_exts = null; + + /** + * Indicates whether the php config file should be injected into the container (default to true). + * + * @var bool + */ + protected $inject_config = true; + + /** + * 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 phpBB compile pass should be used (default to true). + * + * @var bool + */ + protected $use_custom_pass = true; + + /** + * Indicates whether the kernel compile pass should be used (default to true). + * + * @var bool + */ + protected $use_kernel_pass = true; + + /** + * 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 $dump_container = 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 true: + * 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; + + /** + * Constructor + * + * @param \phpbb\config_php_file $config_php_file + * @param string $phpbb_root_path Path to the phpbb includes directory. + * @param string $php_ext php file extension + */ + function __construct(\phpbb\config_php_file $config_php_file, $phpbb_root_path, $php_ext) + { + $this->config_php_file = $config_php_file; + $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(); + if (!defined('DEBUG_CONTAINER') && $this->dump_container && file_exists($container_filename)) + { + require($container_filename); + $this->container = new \phpbb_cache_container(); + } + else + { + if ($this->config_path === null) + { + $this->config_path = $this->phpbb_root_path . 'config'; + } + $container_extensions = array(new \phpbb\di\extension\core($this->config_path)); + + if ($this->use_extensions) + { + $installed_exts = $this->get_installed_extensions(); + $container_extensions[] = new \phpbb\di\extension\ext($installed_exts); + } + + if ($this->inject_config) + { + $container_extensions[] = new \phpbb\di\extension\config($this->config_php_file); + } + + $this->container = $this->create_container($container_extensions); + + if ($this->use_custom_pass) + { + $this->container->addCompilerPass(new \phpbb\di\pass\collection_pass()); + + if ($this->use_kernel_pass) + { + $this->container->addCompilerPass(new \phpbb\di\pass\kernel_pass()); + } + } + + $this->inject_custom_parameters(); + + if ($this->compile_container) + { + $this->container->compile(); + } + + if ($this->dump_container && !defined('DEBUG_CONTAINER')) + { + $this->dump_container($container_filename); + } + } + + $this->container->set('config.php', $this->config_php_file); + + if ($this->compile_container) + { + $this->inject_dbal(); + } + + return $this->container; + } + + /** + * Set if the extensions should be used. + * + * @param bool $use_extensions + */ + public function set_use_extensions($use_extensions) + { + $this->use_extensions = $use_extensions; + } + + /** + * Set if the phpBB compile pass have to be used. + * + * @param bool $use_custom_pass + */ + public function set_use_custom_pass($use_custom_pass) + { + $this->use_custom_pass = $use_custom_pass; + } + + /** + * Set if the kernel compile pass have to be used. + * + * @param bool $use_kernel_pass + */ + public function set_use_kernel_pass($use_kernel_pass) + { + $this->use_kernel_pass = $use_kernel_pass; + } + + /** + * Set if the php config file should be injecting into the container. + * + * @param bool $inject_config + */ + public function set_inject_config($inject_config) + { + $this->inject_config = $inject_config; + } + + /** + * Set if a dump container should be used. + * + * If DEBUG_CONTAINER is set this option is ignored and a new container is build. + * + * @var bool $dump_container + */ + public function set_dump_container($dump_container) + { + $this->dump_container = $dump_container; + } + + /** + * Set if the container should be compiled automatically (default to true). + * + * @var bool $dump_container + */ + public function set_compile_container($compile_container) + { + $this->compile_container = $compile_container; + } + + /** + * Set a custom path to find the configuration of the container + * + * @param string $config_path + */ + public function set_config_path($config_path) + { + $this->config_path = $config_path; + } + + /** + * Set custom parameters to inject into the container. + * + * @param array $custom_parameters + */ + public function set_custom_parameters($custom_parameters) + { + $this->custom_parameters = $custom_parameters; + } + + /** + * Dump the container to the disk. + * + * @param string $container_filename The name of the file. + */ + protected function dump_container($container_filename) + { + $dumper = new PhpDumper($this->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); + } + + /** + * Inject the connection into the container if one was opened. + */ + protected function inject_dbal() + { + if ($this->dbal_connection !== null) + { + $this->container->get('dbal.conn')->set_driver($this->dbal_connection); + } + } + + /** + * Get DB connection. + * + * @return \phpbb\db\driver\driver_interface + */ + protected function get_dbal_connection() + { + if ($this->dbal_connection === null) + { + $dbal_driver_class = $this->config_php_file->convert_30_dbms_to_31($this->config_php_file->get('dbms')); + $this->dbal_connection = new $dbal_driver_class(); + $this->dbal_connection->sql_connect( + $this->config_php_file->get('dbhost'), + $this->config_php_file->get('dbuser'), + $this->config_php_file->get('dbpasswd'), + $this->config_php_file->get('dbname'), + $this->config_php_file->get('dbport'), + defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK + ); + } + + return $this->dbal_connection; + } + + /** + * Get enabled extensions. + * + * @return array enabled extensions + */ + protected function get_installed_extensions() + { + $db = $this->get_dbal_connection(); + $extension_table = $this->config_php_file->get('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']] = $this->phpbb_root_path . 'ext/' . $row['ext_name'] . '/'; + } + + return $exts; + } + + /** + * Create the ContainerBuilder object + * + * @param array $extensions Array of Container extension objects + * @return ContainerBuilder object + */ + protected function create_container(array $extensions) + { + $container = new ContainerBuilder(); + + foreach ($extensions as $extension) + { + $container->registerExtension($extension); + $container->loadFromExtension($extension->getAlias()); + } + + return $container; + } + + /** + * Inject the customs parameters into the container + */ + protected function inject_custom_parameters() + { + if ($this->custom_parameters === null) + { + $this->custom_parameters = array( + 'core.root_path' => $this->phpbb_root_path, + 'core.php_ext' => $this->php_ext, + ); + } + + foreach ($this->custom_parameters as $key => $value) + { + $this->container->setParameter($key, $value); + } + } + + /** + * Get the filename under which the dumped container will be stored. + * + * @return string Path for dumped container + */ + protected function get_container_filename() + { + $filename = str_replace(array('/', '.'), array('slash', 'dot'), $this->phpbb_root_path); + return $this->phpbb_root_path . 'cache/container_' . $filename . '.' . $this->php_ext; + } +} diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php index a7d7284f85..27ebc94bae 100644 --- a/phpBB/phpbb/di/extension/config.php +++ b/phpBB/phpbb/di/extension/config.php @@ -21,9 +21,12 @@ use Symfony\Component\HttpKernel\DependencyInjection\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; } /** @@ -36,17 +39,15 @@ class config extends Extension */ public function load(array $config, ContainerBuilder $container) { - require($this->config_file); - - $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('core.adm_relative_path', ($this->config_php->get('phpbb_adm_relative_path') ? $this->config_php->get('phpbb_adm_relative_path') : 'adm/')); + $container->setParameter('core.table_prefix', $this->config_php->get('table_prefix')); + $container->setParameter('cache.driver.class', $this->convert_30_acm_type($this->config_php->get('acm_type'))); + $container->setParameter('dbal.driver.class', $this->config_php->convert_30_dbms_to_31($this->config_php->get('dbms'))); + $container->setParameter('dbal.dbhost', $this->config_php->get('dbhost')); + $container->setParameter('dbal.dbuser', $this->config_php->get('dbuser')); + $container->setParameter('dbal.dbpasswd', $this->config_php->get('dbpasswd')); + $container->setParameter('dbal.dbname', $this->config_php->get('dbname')); + $container->setParameter('dbal.dbport', $this->config_php->get('dbport')); $container->setParameter('dbal.new_link', defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK); } diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php index 6a2f9008be..9a786022c2 100644 --- a/phpBB/phpbb/event/dispatcher.php +++ b/phpBB/phpbb/event/dispatcher.php @@ -29,8 +29,11 @@ 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 { + /** + * {@inheritdoc} + */ public function trigger_event($eventName, $data = array()) { $event = new \phpbb\event\data($data); diff --git a/phpBB/phpbb/event/dispatcher_interface.php b/phpBB/phpbb/event/dispatcher_interface.php new file mode 100644 index 0000000000..50a3ef9101 --- /dev/null +++ b/phpBB/phpbb/event/dispatcher_interface.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\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()); +} diff --git a/phpBB/phpbb/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php index 323dabb84c..ee9f29a59d 100644 --- a/phpBB/phpbb/event/kernel_request_subscriber.php +++ b/phpBB/phpbb/event/kernel_request_subscriber.php @@ -28,7 +28,7 @@ class kernel_request_subscriber implements EventSubscriberInterface protected $manager; /** - * PHP extension + * PHP file extension * @var string */ protected $php_ext; @@ -44,7 +44,7 @@ class kernel_request_subscriber implements EventSubscriberInterface * * @param \phpbb\extension\manager $manager Extension manager object * @param string $root_path Root path - * @param string $php_ext PHP extension + * @param string $php_ext PHP file extension */ public function __construct(\phpbb\extension\manager $manager, $root_path, $php_ext) { diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php index a11c2a457f..f7021875f3 100644 --- a/phpBB/phpbb/event/md_exporter.php +++ b/phpBB/phpbb/event/md_exporter.php @@ -227,7 +227,7 @@ class md_exporter */ public function validate_since($since) { - if (!preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|rc|pl)\d+)?$#', $since)) + if (!preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $since)) { throw new \LogicException("Invalid since information found for event '{$this->current_event}'"); } diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index 3d2819a3a1..badbbb48fd 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -550,7 +550,7 @@ class php_exporter public function validate_since($line) { $match = array(); - preg_match('#^\* @since (\d+\.\d+\.\d+(?:-(?:a|b|rc|pl)\d+)?)$#', ltrim($line, "\t"), $match); + 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 " diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php index cbbd7bc622..288fb7d19c 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -40,6 +40,7 @@ class base implements \phpbb\extension\extension_interface * * @param ContainerInterface $container Container object * @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 */ @@ -54,6 +55,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 diff --git a/phpBB/phpbb/extension/extension_interface.php b/phpBB/phpbb/extension/extension_interface.php index cc8b8be980..6a6b6adb8f 100644 --- a/phpBB/phpbb/extension/extension_interface.php +++ b/phpBB/phpbb/extension/extension_interface.php @@ -20,6 +20,13 @@ namespace phpbb\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/manager.php b/phpBB/phpbb/extension/manager.php index 52d9395c82..76f0e3558e 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -77,11 +77,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; } @@ -177,6 +178,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); @@ -423,7 +430,7 @@ class manager 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'; @@ -515,7 +522,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)); } @@ -526,12 +533,50 @@ 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']; } /** + * 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 + * + * 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 is_configured($name) + { + 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 diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index 014d8c79c7..1051021ea7 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -306,7 +306,7 @@ class metadata_manager */ public function validate_require_phpbb() { - if (!isset($this->metadata['require']['phpbb/phpbb'])) + if (!isset($this->metadata['extra']['soft-require']['phpbb/phpbb'])) { return false; } @@ -369,7 +369,7 @@ class metadata_manager 'META_REQUIRE_PHP' => (isset($this->metadata['require']['php'])) ? htmlspecialchars($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'])) ? htmlspecialchars($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']) : '', diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php index 9741b752af..198134cdcf 100644 --- a/phpBB/phpbb/feed/helper.php +++ b/phpBB/phpbb/feed/helper.php @@ -36,7 +36,7 @@ class helper * @param \phpbb\config\config $config Config object * @param \phpbb\user $user User object * @param string $phpbb_root_path Root path - * @param string $phpEx PHP extension + * @param string $phpEx PHP file extension */ public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path, $phpEx) { diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index 683a12ab76..77517082e5 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -35,7 +35,7 @@ class filesystem continue; } - if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '..') + if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '.' && $filtered[sizeof($filtered) - 1] !== '..') { array_pop($filtered); } diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index bf0bfe0ae1..2af8b50b54 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -70,7 +70,7 @@ class log implements \phpbb\log\log_interface /** * Event dispatcher object - * @var \phpbb\event\dispatcher + * @var \phpbb\event\dispatcher_interface */ protected $dispatcher; @@ -98,7 +98,7 @@ class log implements \phpbb\log\log_interface * @param \phpbb\db\driver\driver_interface $db Database object * @param \phpbb\user $user User object * @param \phpbb\auth\auth $auth Auth object - * @param \phpbb\event\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 @@ -245,9 +245,9 @@ 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']); $sql_ary += array( 'log_type' => LOG_MOD, @@ -737,7 +737,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'; diff --git a/phpBB/phpbb/message/admin_form.php b/phpBB/phpbb/message/admin_form.php index b71b3fc535..93db59880c 100644 --- a/phpBB/phpbb/message/admin_form.php +++ b/phpBB/phpbb/message/admin_form.php @@ -1,9 +1,13 @@ <?php /** * -* @package message -* @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. * */ @@ -12,8 +16,6 @@ namespace phpbb\message; /** * Class admin_form * Displays a message to the user and allows him to send an email -* -* @package phpbb\message */ class admin_form extends form { diff --git a/phpBB/phpbb/message/form.php b/phpBB/phpbb/message/form.php index d7a42c4080..076b41dc07 100644 --- a/phpBB/phpbb/message/form.php +++ b/phpBB/phpbb/message/form.php @@ -1,9 +1,13 @@ <?php /** * -* @package message -* @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,8 +15,6 @@ namespace phpbb\message; /** * Abstract class form -* -* @package phpbb\message */ abstract class form { diff --git a/phpBB/phpbb/message/message.php b/phpBB/phpbb/message/message.php index 7ba2b2f32d..5fd24b542e 100644 --- a/phpBB/phpbb/message/message.php +++ b/phpBB/phpbb/message/message.php @@ -1,9 +1,13 @@ <?php /** * -* @package message -* @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. * */ @@ -12,8 +16,6 @@ namespace phpbb\message; /** * Class message * Holds all information for an email and sends it in the end -* -* @package phpbb\message */ class message { diff --git a/phpBB/phpbb/message/topic_form.php b/phpBB/phpbb/message/topic_form.php index 3a35c35d21..1e0f2a1945 100644 --- a/phpBB/phpbb/message/topic_form.php +++ b/phpBB/phpbb/message/topic_form.php @@ -1,9 +1,13 @@ <?php /** * -* @package message -* @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. * */ @@ -12,8 +16,6 @@ namespace phpbb\message; /** * Class topic_form * Form used to send topics as notification emails -* -* @package phpbb\message */ class topic_form extends form { diff --git a/phpBB/phpbb/message/user_form.php b/phpBB/phpbb/message/user_form.php index 7aa4b94def..007e575407 100644 --- a/phpBB/phpbb/message/user_form.php +++ b/phpBB/phpbb/message/user_form.php @@ -1,9 +1,13 @@ <?php /** * -* @package message -* @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. * */ @@ -12,8 +16,6 @@ namespace phpbb\message; /** * Class user_form * Allows users to send emails to other users -* -* @package phpbb\message */ class user_form extends form { diff --git a/phpBB/phpbb/mimetype/guesser.php b/phpBB/phpbb/mimetype/guesser.php index 87b164b561..773a1f822a 100644 --- a/phpBB/phpbb/mimetype/guesser.php +++ b/phpBB/phpbb/mimetype/guesser.php @@ -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 */ diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 74ef980445..5e4bab1530 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -68,12 +68,14 @@ class manager * @param \phpbb\user_loader $user_loader * @param \phpbb\config\config $config * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\cache\service $cache * @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, ContainerInterface $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) @@ -832,7 +834,7 @@ 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) { diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php index a6735dc793..0aad19d6bf 100644 --- a/phpBB/phpbb/notification/type/approve_post.php +++ b/phpBB/phpbb/notification/type/approve_post.php @@ -67,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 */ diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php index 459a0ec348..e649f3920e 100644 --- a/phpBB/phpbb/notification/type/approve_topic.php +++ b/phpBB/phpbb/notification/type/approve_topic.php @@ -67,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 */ diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index c1d4d0e257..a11ad76db9 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -161,6 +161,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) @@ -174,7 +176,6 @@ abstract class base implements \phpbb\notification\type\type_interface * * Primarily for testing * - * @param string $name * @return mixed */ public function __toString() @@ -308,16 +309,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 : '', ); } @@ -337,6 +337,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 @@ -347,6 +357,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 diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index f4870e8a52..c83288cfb8 100644 --- a/phpBB/phpbb/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php @@ -59,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 */ diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php index b5f94f404f..7b18ed70ea 100644 --- a/phpBB/phpbb/notification/type/disapprove_post.php +++ b/phpBB/phpbb/notification/type/disapprove_post.php @@ -31,6 +31,16 @@ class disapprove_post extends \phpbb\notification\type\approve_post } /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class() + { + return 'notification-disapproved'; + } + + /** * Language key used to output the text * * @var string @@ -63,9 +73,31 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ public function get_title() { + return $this->user->lang($this->language_key); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->user->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->user->lang( - $this->language_key, - censor_text($this->get_data('topic_title')), + 'NOTIFICATION_REASON', $this->get_data('disapprove_reason') ); } diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php index 8883c53294..3f87741807 100644 --- a/phpBB/phpbb/notification/type/disapprove_topic.php +++ b/phpBB/phpbb/notification/type/disapprove_topic.php @@ -31,6 +31,16 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic } /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class() + { + return 'notification-disapproved'; + } + + /** * Language key used to output the text * * @var string @@ -63,9 +73,31 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ public function get_title() { + return $this->user->lang($this->language_key); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->user->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->user->lang( - $this->language_key, - censor_text($this->get_data('topic_title')), + 'NOTIFICATION_REASON', $this->get_data('disapprove_reason') ); } diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index 955d121cc6..8445ca4b22 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -72,7 +72,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 */ @@ -111,7 +112,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->user->lang('NOTIFICATION_PM', $username); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->user->lang( + 'NOTIFICATION_REFERENCE', + $this->get_data('message_subject') + ); } /** @@ -165,7 +179,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 $pm 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 diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index c8760f904e..357176ec35 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -86,7 +86,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 */ @@ -225,12 +226,24 @@ class post extends \phpbb\notification\type\base return $this->user->lang( $this->language_key, phpbb_generate_string_list($usernames, $this->user), - censor_text($this->get_data('topic_title')), $responders_cnt ); } /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->user->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('topic_title')) + ); + } + + /** * Get email template * * @return string|bool diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php index b893ad0d15..3bb1028619 100644 --- a/phpBB/phpbb/notification/type/post_in_queue.php +++ b/phpBB/phpbb/notification/type/post_in_queue.php @@ -70,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 */ diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 7c61b76b58..6e672e6fbd 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -66,7 +66,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 */ @@ -122,7 +123,7 @@ class quote extends \phpbb\notification\type\post /** * 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 */ public function update_notifications($post) { diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 03e89dd28e..14a328e104 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -31,6 +31,16 @@ class report_pm extends \phpbb\notification\type\pm } /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class() + { + return 'notification-reported'; + } + + /** * Language key used to output the text * * @var string @@ -84,6 +94,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 */ @@ -159,12 +170,36 @@ class report_pm extends \phpbb\notification\type\pm $username = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); + return $this->user->lang( + $this->language_key, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->user->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')), + 'NOTIFICATION_REASON', $this->get_data('report_text') ); } @@ -172,17 +207,13 @@ class report_pm extends \phpbb\notification\type\pm if (isset($this->user->lang[$this->get_data('reason_title')])) { return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('message_subject')), + 'NOTIFICATION_REASON', $this->user->lang[$this->get_data('reason_title')] ); } return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('message_subject')), + 'NOTIFICATION_REASON', $this->get_data('reason_description') ); } diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index a646996f75..de7bf74a97 100644 --- a/phpBB/phpbb/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php @@ -52,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 */ @@ -107,7 +108,19 @@ class report_pm_closed extends \phpbb\notification\type\pm return $this->user->lang( $this->language_key, - $username, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->user->lang( + 'NOTIFICATION_REFERENCE', censor_text($this->get_data('message_subject')) ); } diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index d5589a6756..bec59df9d5 100644 --- a/phpBB/phpbb/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php @@ -30,6 +30,16 @@ class report_post extends \phpbb\notification\type\post_in_queue } /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class() + { + return 'notification-reported'; + } + + /** * Language key used to output the text * * @var string @@ -66,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 */ @@ -132,12 +143,36 @@ class report_post extends \phpbb\notification\type\post_in_queue $username = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); + return $this->user->lang( + $this->language_key, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->user->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')), + 'NOTIFICATION_REASON', $this->get_data('report_text') ); } @@ -145,17 +180,13 @@ class report_post extends \phpbb\notification\type\post_in_queue if (isset($this->user->lang[$this->get_data('reason_title')])) { return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('post_subject')), + 'NOTIFICATION_REASON', $this->user->lang[$this->get_data('reason_title')] ); } return $this->user->lang( - $this->language_key, - $username, - censor_text($this->get_data('post_subject')), + 'NOTIFICATION_REASON', $this->get_data('reason_description') ); } diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index e76fa57036..cd1400f8fa 100644 --- a/phpBB/phpbb/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php @@ -59,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 */ @@ -114,7 +115,19 @@ class report_post_closed extends \phpbb\notification\type\post return $this->user->lang( $this->language_key, - $username, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->user->lang( + 'NOTIFICATION_REFERENCE', censor_text($this->get_data('post_subject')) ); } diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 144c4e58a0..289e45bedb 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -87,6 +87,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 */ @@ -151,8 +152,32 @@ class topic extends \phpbb\notification\type\base return $this->user->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->user->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->user->lang( + 'NOTIFICATION_FORUM', $this->get_data('forum_name') ); } diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php index 2d54a68648..aef1487d77 100644 --- a/phpBB/phpbb/notification/type/topic_in_queue.php +++ b/phpBB/phpbb/notification/type/topic_in_queue.php @@ -70,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 */ diff --git a/phpBB/phpbb/notification/type/type_interface.php b/phpBB/phpbb/notification/type/type_interface.php index c91c7078ad..5c5a110836 100644 --- a/phpBB/phpbb/notification/type/type_interface.php +++ b/phpBB/phpbb/notification/type/type_interface.php @@ -88,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 @@ -95,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 diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index a5314d2ce1..38dbbab51e 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -24,6 +24,9 @@ class path_helper /** @var \phpbb\filesystem */ protected $filesystem; + /** @var \phpbb\request\request_interface */ + protected $request; + /** @var string */ protected $phpbb_root_path; @@ -41,13 +44,16 @@ class path_helper * * @param \phpbb\symfony_request $symfony_request * @param \phpbb\filesystem $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, \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; @@ -98,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; @@ -158,7 +170,7 @@ class path_helper */ if ($path_info === '/' && preg_match('/app\.' . $this->php_ext . '\/$/', $request_uri)) { - return $this->web_root_path = $this->phpbb_root_path . '../'; + return $this->web_root_path = $this->filesystem->clean_path('./../' . $this->phpbb_root_path); } /* @@ -170,31 +182,111 @@ 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')) + { + $referer_web_root_path = $this->get_web_root_path_from_ajax_referer( + $this->symfony_request->get('_referer'), + $this->symfony_request->getSchemeAndHttpHost() . $this->symfony_request->getBasePath() + ); + 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 (strpos($absolute_board_url, $referer_dir) !== 0) + { + $fixed_root_path .= '../'; + $referer_dir = dirname($referer_dir); + } + + $fixed_root_path .= substr($absolute_board_url, strlen($referer_dir) + 1); + // Add trailing slash + return $this->phpbb_root_path . $fixed_root_path . '/'; } /** diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php index 3f51016c93..9b3dcadf32 100644 --- a/phpBB/phpbb/permissions.php +++ b/phpBB/phpbb/permissions.php @@ -17,7 +17,7 @@ class permissions { /** * Event dispatcher object - * @var \phpbb\event\dispatcher + * @var \phpbb\event\dispatcher_interface */ protected $dispatcher; @@ -30,10 +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 */ - 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; diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index c610d49a63..3c686a552f 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -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,6 +119,9 @@ 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, @@ -372,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 c055931181..2e353722b2 100644 --- a/phpBB/phpbb/profilefields/lang_helper.php +++ b/phpBB/phpbb/profilefields/lang_helper.php @@ -49,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])) + { + $this->options_lang[$field_id] = array(); + } + if (!isset($this->options_lang[$field_id][$lang_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][$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 490db0419a..98802d2209 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -32,7 +32,7 @@ class manager /** * Event dispatcher object - * @var \phpbb\event\dispatcher + * @var \phpbb\event\dispatcher_interface */ protected $dispatcher; @@ -73,7 +73,7 @@ class manager * * @param \phpbb\auth\auth $auth Auth object * @param \phpbb\db\driver\driver_interface $db Database object - * @param \phpbb\event\dispatcher $dispatcher Event dispatcher 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 @@ -82,7 +82,7 @@ class manager * @param string $fields_language_table * @param string $fields_data_table */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\event\dispatcher $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) + 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; @@ -389,6 +389,7 @@ class manager { $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']); if ($value === null) { @@ -396,7 +397,7 @@ class manager } $field_desc = $contact_url = ''; - if ($use_contact_fields) + 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']); @@ -412,26 +413,28 @@ class manager } $tpl_fields['row'] += array( - 'PROFILE_' . strtoupper($ident) . '_IDENT' => $ident, - 'PROFILE_' . strtoupper($ident) . '_VALUE' => $value, - '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']), + '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_IDENT' => $ident, - 'PROFILE_FIELD_VALUE' => $value, - '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']), + '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, diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index eb8d3e47d6..0582722833 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -155,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']) @@ -180,6 +180,24 @@ class type_bool 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']; @@ -203,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']); diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php index 158eec6a0c..90ac9a6703 100644 --- a/phpBB/phpbb/profilefields/type/type_date.php +++ b/phpBB/phpbb/profilefields/type/type_date.php @@ -208,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 52c9fcf86a..17ae89e1b2 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -135,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)) @@ -160,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']) @@ -189,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']; @@ -199,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..887baa3de1 --- /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' => '[\w]+', + '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 78f1c7d2c9..dd08df94c1 100644 --- a/phpBB/phpbb/profilefields/type/type_int.php +++ b/phpBB/phpbb/profilefields/type/type_int.php @@ -154,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 489e916fd5..ec770f9467 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -94,6 +94,15 @@ 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 @@ -180,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_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php index 7d0cb04d7c..0eaf7e527d 100644 --- a/phpBB/phpbb/profilefields/type/type_string_common.php +++ b/phpBB/phpbb/profilefields/type/type_string_common.php @@ -20,7 +20,9 @@ abstract class type_string_common extends type_base 'NUMBERS_ONLY' => '[0-9]+', 'ALPHA_ONLY' => '[\w]+', 'ALPHA_UNDERSCORE' => '[\w_]+', + 'ALPHA_DOTS' => '[\w.]+', 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+', + 'ALPHA_PUNCTUATION' => '[a-zA-Z][\w\.,\-_]+', ); /** @@ -96,7 +98,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; } @@ -110,9 +112,9 @@ abstract class type_string_common extends type_base /** * {@inheritDoc} */ - public function get_profile_contact_value($field_value, $field_data) + public function get_profile_value_raw($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; } @@ -123,6 +125,14 @@ abstract class type_string_common extends type_base /** * {@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/search/base.php b/phpBB/phpbb/search/base.php index 861b1f9328..30781975d8 100644 --- a/phpBB/phpbb/search/base.php +++ b/phpBB/phpbb/search/base.php @@ -85,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 */ @@ -160,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) { @@ -282,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 @@ -303,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 3e8e492cd8..1a0aba096f 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -73,6 +73,12 @@ 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 */ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) { @@ -140,7 +146,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']; } @@ -764,7 +770,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'; } @@ -777,7 +783,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'; } @@ -872,7 +878,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 f7b1751a51..48b0f077c7 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -758,7 +758,7 @@ class fulltext_native extends \phpbb\search\base ); } - switch ($this->db->sql_layer) + switch ($this->db->get_sql_layer()) { case 'mysql4': case 'mysqli': @@ -978,7 +978,7 @@ class fulltext_native extends \phpbb\search\base // 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': @@ -1000,7 +1000,7 @@ class fulltext_native extends \phpbb\search\base } else { - if ($this->db->sql_layer == 'sqlite' || $this->db->sql_layer == 'sqlite3') + 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'; @@ -1017,7 +1017,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' || $this->db->sql_layer == 'sqlite3') ? ')' : ''); + $sql_time" . (($this->db->get_sql_layer() == 'sqlite' || $this->db->get_sql_layer() == 'sqlite3') ? ')' : ''); } $result = $this->db->sql_query($sql); @@ -1481,11 +1481,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 'sqlite3': - case 'firebird': $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); diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index bdb5a86009..b6af371d13 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -31,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 */ @@ -98,6 +86,12 @@ 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 */ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) { @@ -107,16 +101,6 @@ class fulltext_postgres extends \phpbb\search\base $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 */ @@ -185,16 +169,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; } @@ -869,7 +848,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; @@ -913,13 +892,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 9008af338b..79d68d2ae1 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -119,6 +119,12 @@ 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 */ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user) { @@ -199,7 +205,7 @@ 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']; } @@ -218,11 +224,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'; } diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 59b7ec2029..5a0d7c0031 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1062,11 +1062,13 @@ class session * 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) { @@ -1254,12 +1256,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) diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php index 5a01ee3a93..67dbd7b357 100644 --- a/phpBB/phpbb/template/asset.php +++ b/phpBB/phpbb/template/asset.php @@ -24,6 +24,7 @@ class asset * Constructor * * @param string $url URL + * @param \phpbb\path_helper $path_helper Path helper object */ public function __construct($url, \phpbb\path_helper $path_helper) { diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 0a32879943..4ee48205c8 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -34,6 +34,11 @@ class context */ private $rootref; + /** + * @var bool + */ + private $num_rows_is_set; + public function __construct() { $this->clear(); @@ -46,6 +51,7 @@ class context { $this->tpldata = array('.' => array(0 => array())); $this->rootref = &$this->tpldata['.'][0]; + $this->num_rows_is_set = false; } /** @@ -95,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. @@ -123,6 +178,7 @@ class context */ public function assign_block_vars($blockname, array $vararray) { + $this->num_rows_is_set = false; if (strpos($blockname, '.') !== false) { // Nested block. @@ -160,13 +216,6 @@ class context // We're adding a new iteration to this block with the given // variable assignments. $str[$blocks[$blockcount]][] = $vararray; - $s_num_rows = sizeof($str[$blocks[$blockcount]]); - - // Set S_NUM_ROWS - foreach ($str[$blocks[$blockcount]] as &$mod_block) - { - $mod_block['S_NUM_ROWS'] = $s_num_rows; - } } else { @@ -192,13 +241,6 @@ class context // Add a new iteration to this block with the variable assignments we were given. $this->tpldata[$blockname][] = $vararray; - $s_num_rows = sizeof($this->tpldata[$blockname]); - - // Set S_NUM_ROWS - foreach ($this->tpldata[$blockname] as &$mod_block) - { - $mod_block['S_NUM_ROWS'] = $s_num_rows; - } } return true; @@ -250,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. @@ -349,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; } @@ -382,6 +419,7 @@ class context */ public function destroy_block_vars($blockname) { + $this->num_rows_is_set = false; if (strpos($blockname, '.') !== false) { // Nested block. diff --git a/phpBB/phpbb/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php index 39653f6d26..cb3c953692 100644 --- a/phpBB/phpbb/template/twig/definition.php +++ b/phpBB/phpbb/template/twig/definition.php @@ -25,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 8d25153e14..476ffd935e 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -36,11 +36,10 @@ 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\path_helper $path_helper phpBB path helper + * @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()) diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 8f523684dd..3a983491b9 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -162,7 +162,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() diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index cceefda7ef..c5dc7273ba 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -285,7 +285,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/tree/tree_interface.php b/phpBB/phpbb/tree/tree_interface.php index 8238a072ff..5df01a89cf 100644 --- a/phpBB/phpbb/tree/tree_interface.php +++ b/phpBB/phpbb/tree/tree_interface.php @@ -18,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/viewonline_helper.php b/phpBB/phpbb/viewonline_helper.php new file mode 100644 index 0000000000..b722f9d911 --- /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 */ + protected $filesystem; + + /** + * @param \phpbb\filesystem $filesystem + */ + public function __construct(\phpbb\filesystem $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 60bb595da6..6638caa94b 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -195,7 +195,7 @@ switch ($mode) } else { - upload_popup(); + phpbb_upload_popup(); return; } break; @@ -233,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; } @@ -439,7 +439,7 @@ if ($mode == 'delete' || $mode == 'soft_delete') $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); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $soft_delete_reason); return; } @@ -523,7 +523,9 @@ $orig_poll_options_size = sizeof($post_data['poll_options']); $message_parser = new parse_message(); $plupload = $phpbb_container->get('plupload'); +$mimetype_guesser = $phpbb_container->get('mimetype.guesser'); $message_parser->set_plupload($plupload); +$message_parser->set_mimetype_guesser($mimetype_guesser); if (isset($post_data['post_text'])) { @@ -1028,6 +1030,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'] && @@ -1251,7 +1261,7 @@ if ($submit || $preview || $refresh) { $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); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $soft_delete_reason); return; } @@ -1714,137 +1724,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']); - - $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, $soft_delete_reason); - - $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, $soft_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/search.php b/phpBB/search.php index f1f02ac766..071db30f3d 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -145,7 +145,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 . " @@ -159,7 +159,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 . " @@ -172,7 +172,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)) @@ -923,16 +923,19 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @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', @@ -1293,7 +1296,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/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index f3dd72cb52..520b1f0e98 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -21,8 +21,8 @@ # General Information about this style name = prosilver copyright = © phpBB Limited, 2007 -style_version = 3.1.0-b4 -phpbb_version = 3.1.0-b4 +style_version = 3.1.0-RC2 +phpbb_version = 3.1.0-RC2 # 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 e9f8064b9e..649a384418 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -2,17 +2,6 @@ "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) { - phpbbAlertTimer = setTimeout(function() { - $('#darkenwrapper').trigger('click'); - }, delay); -}; - // This callback will mark all forum icons read phpbb.addAjaxCallback('mark_forums_read', function(res) { var readTitle = res.NO_UNREAD_POSTS; @@ -356,37 +345,6 @@ $('.display_post').click(function(e) { $('#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).prop('checked')) { $('#delete_reason').hide(); diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 3d42439c1d..4929e14ef7 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -378,47 +378,11 @@ function parse_document(container) }); /** - * 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'); - } - - 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); - }); - - /** * 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; + container.find('ul.linklist.bulletin > li:first-child, ul.linklist.bulletin > li.rightside:last-child').addClass('no-bulletin'); } /** @@ -516,6 +480,167 @@ function parse_document(container) }); /** + * Responsive link lists + */ + container.find('.linklist:not(.navlinks, [data-skip-responsive]), .postbody .post-buttons:not([data-skip-responsive])').each(function() { + var $this = $(this), + $body = $('body'), + filterSkip = '.breadcrumbs, [data-skip-responsive]', + filterLast = '.edit-icon, .quote-icon, [data-last-responsive]', + persist = $this.attr('id') == 'nav-main', + 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), + slack = 1; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured. + + if (!persist) { + if (links.is('.rightside')) + { + links.filter('.rightside:first').before(html); + $this.children('.responsive-menu').addClass('rightside'); + } + 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; + } + + // Unhide the quick-links menu if it has content + if (persist) { + item.addClass('hidden'); + if (menu.find('li:not(.separator, .clone)').length || (responsive && menu.find('li.clone').length)) { + item.removeClass('hidden'); + } + } + + // Reset responsive and compact layout + if (responsive) { + responsive = false; + $this.removeClass('responsive'); + links.css('display', ''); + if (!persist) 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 + slack)) { + 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 + slack)) { + 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() { + if (persist) $(this).addClass('clone'); + menu.prepend(this); + }); + + if (persist) { + menu.prepend(clone.not('.rightside').addClass('clone')); + } else { + menu.prepend(clone.not('.rightside')); + } + + menu.find('li.leftside, li.rightside').removeClass('leftside rightside'); + menu.find('.inputbox').parents('li:first').css('white-space', 'normal'); + + if ($this.hasClass('post-buttons')) { + $('.button', menu).removeClass('button icon-button'); + $('.responsive-menu-link', item).addClass('button icon-button').prepend('<span></span>'); + } + 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 + slack)) { + menu.children().filter(filterLast).css('display', 'none'); + return; + } + } + + // If even responsive isn't enough, use both responsive and compact at same time + compact = true; + $this.addClass('compact'); + + links.css('display', 'none'); + } + + if (!persist) phpbb.registerDropdown(item.find('a.responsive-menu-link'), item.find('.dropdown')); + + 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'); @@ -700,136 +825,6 @@ function parse_document(container) }); /** - * Responsive link lists - */ - container.find('.linklist:not(.navlinks, [data-skip-responsive]), .postbody .post-buttons: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'); - - if ($this.hasClass('post-buttons')) { - $('.button', menu).removeClass('button icon-button'); - $('.responsive-menu-link', item).addClass('button icon-button').prepend('<span></span>'); - } - 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() { @@ -838,7 +833,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, @@ -880,7 +875,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); }); diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index f9c5b4cf20..1e1eb22c6f 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -1,27 +1,15 @@ <!-- 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">{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 --> diff --git a/phpBB/styles/prosilver/template/jumpbox.html b/phpBB/styles/prosilver/template/jumpbox.html index 47d322407d..44b479ab3f 100644 --- a/phpBB/styles/prosilver/template/jumpbox.html +++ b/phpBB/styles/prosilver/template/jumpbox.html @@ -10,24 +10,22 @@ <!-- 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="dropdown-container dropdown-container-{S_CONTENT_FLOW_END}<!-- 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="dropdown-trigger button dropdown-select"> + <!-- 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> + <div class="dropdown hidden"> + <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><!-- BEGIN level --> <!-- END level --><a href="{jumpbox_forums.LINK}">{jumpbox_forums.FORUM_NAME}</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/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_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index c9f81a4099..8fdec01212 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -48,6 +48,13 @@ <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</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 -->{topicrow.ATTACH_ICON_IMG} <!-- 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> @@ -62,15 +69,11 @@ </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} » {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> </div> </dt> diff --git a/phpBB/styles/prosilver/template/mcp_header.html b/phpBB/styles/prosilver/template/mcp_header.html index bdfa254741..69239887e3 100644 --- a/phpBB/styles/prosilver/template/mcp_header.html +++ b/phpBB/styles/prosilver/template/mcp_header.html @@ -11,7 +11,7 @@ <div id="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> @@ -22,7 +22,7 @@ <div style="width: 100%;"> <div id="cp-menu"> - <div id="navigation"> + <div id="navigation" role="navigation"> <ul> <!-- BEGIN l_block1 --> <!-- IF l_block1.S_SELECTED --> diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index a83b42dba0..6bf6af1b78 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="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,7 +31,7 @@ <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> @@ -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 --> @@ -66,7 +66,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> diff --git a/phpBB/styles/prosilver/template/memberlist_search.html b/phpBB/styles/prosilver/template/memberlist_search.html index f4439b6934..4fba966151 100644 --- a/phpBB/styles/prosilver/template/memberlist_search.html +++ b/phpBB/styles/prosilver/template/memberlist_search.html @@ -10,9 +10,9 @@ <dl style="overflow: visible;"> <dt><label for="username">{L_USERNAME}{L_COLON}</label></dt> <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-container"> <div class="dropdown live-search hidden" id="user-search"> <div class="pointer"><div class="pointer-inner"></div></div> <ul class="dropdown-contents search-results"> @@ -29,18 +29,20 @@ <dd><input type="text" name="email" id="email" value="{EMAIL}" class="inputbox" /></dd> </dl> <!-- ENDIF --> +<!-- IF S_JABBER_ENABLED --> <dl> <dt><label for="jabber">{L_JABBER}:</label></dt> <dd><input type="text" name="jabber" id="jabber" value="{JABBER}" class="inputbox" /></dd> </dl> - <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> +<!-- 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> </fieldset> <fieldset class="fields1 column2"> diff --git a/phpBB/styles/prosilver/template/navbar_footer.html b/phpBB/styles/prosilver/template/navbar_footer.html index 6912ee242e..4a9275c898 100644 --- a/phpBB/styles/prosilver/template/navbar_footer.html +++ b/phpBB/styles/prosilver/template/navbar_footer.html @@ -1,23 +1,26 @@ <div class="navbar"> <div class="inner"> - <ul class="linklist bulletin"> + <ul id="nav-footer" class="linklist bulletin" role="menubar"> <li class="small-icon icon-home breadcrumbs"> - <!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}">{L_SITE_HOME}</a></span><!-- ENDIF --> - <span class="crumb"><a href="{U_INDEX}">{L_INDEX}</a></span> + <!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}" data-navbar-reference="home">{L_SITE_HOME}</a></span><!-- ENDIF --> + <!-- EVENT overall_footer_breadcrumb_prepend --> + <span class="crumb"><a href="{U_INDEX}" data-navbar-reference="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 --> + <!-- IF U_WATCH_FORUM_LINK and not S_IS_BOT --><li class="small-icon icon-<!-- IF S_WATCHING_FORUM -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-last-responsive="true"><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 --> + <!-- 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">{L_DELETE_COOKIES}</a></li><!-- ENDIF --> + <!-- IF not S_IS_BOT --> + <li class="small-icon icon-delete-cookies rightside"><a href="{U_DELETE_COOKIES}" data-ajax="true" data-refresh="true" role="menuitem">{L_DELETE_COOKIES}</a></li> + <!-- IF S_DISPLAY_MEMBERLIST --><li class="small-icon icon-members rightside" data-last-responsive="true"><a href="{U_MEMBERLIST}" title="{L_MEMBERLIST_EXPLAIN}" role="menuitem">{L_MEMBERLIST}</a></li><!-- ENDIF --> + <!-- ENDIF --> <!-- EVENT overall_footer_teamlink_before --> - <!-- IF U_TEAM --><li class="rightside"><a href="{U_TEAM}">{L_THE_TEAM}</a></li><!-- ENDIF --> - <!-- IF U_CONTACT_US --><li class="rightside"><a href="{U_CONTACT_US}">{L_CONTACT_US}</a></li><!-- ENDIF --> + <!-- IF U_TEAM --><li class="small-icon icon-team rightside" data-last-responsive="true"><a href="{U_TEAM}" role="menuitem">{L_THE_TEAM}</a></li><!-- ENDIF --> <!-- EVENT overall_footer_teamlink_after --> + <!-- IF U_CONTACT_US --><li class="small-icon icon-contact rightside" data-last-responsive="true"><a href="{U_CONTACT_US}" role="menuitem">{L_CONTACT_US}</a></li><!-- ENDIF --> </ul> </div> diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html index 804fa5b2aa..68759c3c4c 100644 --- a/phpBB/styles/prosilver/template/navbar_header.html +++ b/phpBB/styles/prosilver/template/navbar_header.html @@ -1,51 +1,113 @@ -<div class="navbar"> +<div class="navbar" role="navigation"> <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></span><!-- ENDIF --> - <span class="crumb"><a href="{U_INDEX}" accesskey="h"{$MICRODATA}>{L_INDEX}</a></span> - <!-- BEGIN navlinks --><!-- EVENT overall_header_navlink_prepend --><span class="crumb"><a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}>{navlinks.FORUM_NAME}</a></span><!-- EVENT overall_header_navlink_append --><!-- END navlinks --> - <!-- EVENT overall_header_breadcrumb_append --> + <ul id="nav-main" class="linklist bulletin" role="menubar"> + + <li id="quick-links" class="small-icon responsive-menu dropdown-container<!-- IF not S_DISPLAY_QUICK_LINKS and not S_DISPLAY_SEARCH --> hidden<!-- ENDIF -->" data-skip-responsive="true"> + <a href="#" class="responsive-menu-link dropdown-trigger">{L_QUICK_LINKS}</a> + <div class="dropdown hidden"> + <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 class="small-icon icon-search-self"><a href="{U_SEARCH_SELF}" role="menuitem">{L_SEARCH_SELF}</a></li> + <!-- ENDIF --> + <!-- IF S_USER_LOGGED_IN --> + <li class="small-icon icon-search-new"><a href="{U_SEARCH_NEW}" role="menuitem">{L_SEARCH_NEW}</a></li> + <!-- ENDIF --> + <!-- IF S_LOAD_UNREADS --> + <li class="small-icon icon-search-unread"><a href="{U_SEARCH_UNREAD}" role="menuitem">{L_SEARCH_UNREAD}</a></li> + <!-- ENDIF --> + <li class="small-icon icon-search-unanswered"><a href="{U_SEARCH_UNANSWERED}" role="menuitem">{L_SEARCH_UNANSWERED}</a></li> + <li class="small-icon icon-search-active"><a href="{U_SEARCH_ACTIVE_TOPICS}" role="menuitem">{L_SEARCH_ACTIVE_TOPICS}</a></li> + <li class="separator"></li> + <li class="small-icon icon-search"><a href="{U_SEARCH}" role="menuitem">{L_SEARCH}</a></li> + <!-- ENDIF --> + + <!-- IF not S_IS_BOT and (S_DISPLAY_MEMBERLIST or U_TEAM) --> + <li class="separator"></li> + <!-- IF S_DISPLAY_MEMBERLIST --><li class="small-icon icon-members"><a href="{U_MEMBERLIST}" role="menuitem">{L_MEMBERLIST}</a></li><!-- ENDIF --> + <!-- IF U_TEAM --><li class="small-icon icon-team"><a href="{U_TEAM}" role="menuitem">{L_THE_TEAM}</a></li><!-- ENDIF --> + <!-- ENDIF --> + <li class="separator"></li> + + <!-- EVENT navbar_header_quick_links_after --> + </ul> + </div> </li> - <!-- IF S_REGISTERED_USER --><li id="username_logged_in" class="rightside"><!-- IF CURRENT_USER_AVATAR --><a href="{U_USER_PROFILE}" class="header-avatar">{CURRENT_USER_AVATAR}</a> <!-- ENDIF -->{CURRENT_USERNAME_FULL}</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> + <!-- EVENT overall_header_navigation_prepend --> + <li class="small-icon icon-faq" <!-- 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">{L_FAQ}</a></li> + <!-- EVENT overall_header_navigation_append --> + <!-- IF U_ACP --><li class="small-icon icon-acp" data-last-responsive="true"><a href="{U_ACP}" title="{L_ACP}" role="menuitem">{L_ACP_SHORT}</a></li><!-- ENDIF --> + <!-- IF U_MCP --><li class="small-icon icon-mcp" data-skip-responsive="true"><a href="{U_MCP}" title="{L_MCP}" role="menuitem">{L_MCP_SHORT}</a></li><!-- ENDIF --> - <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> - <!-- INCLUDE notification_dropdown.html --> + <!-- 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 hidden"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents" role="menu"> + <!-- IF U_RESTORE_PERMISSIONS --><li class="small-icon icon-restore-permissions"><a href="{U_RESTORE_PERMISSIONS}">{L_RESTORE_PERMISSIONS}</a></li><!-- ENDIF --> + + <!-- EVENT navbar_header_profile_list_before --> + + <li class="small-icon icon-ucp"><a href="{U_PROFILE}" title="{L_PROFILE}" role="menuitem">{L_PROFILE}</a></li> + <li class="small-icon icon-profile"><a href="{U_USER_PROFILE}" title="{L_READ_PROFILE}" role="menuitem">{L_READ_PROFILE}</a></li> + + <!-- EVENT navbar_header_profile_list_after --> + + <li class="separator"></li> + <li class="small-icon icon-logout"><a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x" role="menuitem">{L_LOGIN_LOGOUT}</a></li> + </ul> + </div> + </div> + <!-- EVENT navbar_header_username_append --> </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 class="small-icon icon-pm rightside" data-skip-responsive="true"> + <a href="{U_PRIVATEMSGS}" role="menuitem"><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> + <!-- IF S_NOTIFICATIONS_DISPLAY --> + <li class="small-icon icon-notification 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"><span>{L_NOTIFICATIONS} [</span><strong>{NOTIFICATIONS_COUNT}</strong><span>]</span></a> + <!-- INCLUDE notification_dropdown.html --> + </li> <!-- ENDIF --> - <!-- IF U_RESTORE_PERMISSIONS --> - <li class="icon-restore-permissions"><a href="{U_RESTORE_PERMISSIONS}">{L_RESTORE_PERMISSIONS}</a></li> + <!-- ELSE --> + <li class="small-icon icon-logout rightside" data-skip-responsive="true"><a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x" role="menuitem">{L_LOGIN_LOGOUT}</a></li> + <!-- IF S_REGISTER_ENABLED and not (S_SHOW_COPPA or S_REGISTRATION) --> + <li class="small-icon icon-register rightside" data-skip-responsive="true"><a href="{U_REGISTER}" role="menuitem">{L_REGISTER}</a></li> <!-- ENDIF --> + <!-- EVENT navbar_header_logged_out_content --> <!-- ENDIF --> + </ul> - <!-- 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 --> + <ul id="nav-breadcrumbs" class="linklist navlinks" role="menubar"> + <!-- DEFINE $MICRODATA = ' itemtype="http://data-vocabulary.org/Breadcrumb" itemscope=""' --> + <!-- EVENT overall_header_breadcrumbs_before --> + <li class="small-icon icon-home breadcrumbs"> + <!-- IF U_SITE_HOME --><span class="crumb"><a href="{U_SITE_HOME}"{$MICRODATA} data-navbar-reference="home">{L_SITE_HOME}</a></span><!-- ENDIF --> + <!-- EVENT overall_header_breadcrumb_prepend --> + <span class="crumb"><a href="{U_INDEX}" accesskey="h"{$MICRODATA} data-navbar-reference="index">{L_INDEX}</a></span> + <!-- BEGIN navlinks --> + <!-- EVENT overall_header_navlink_prepend --> + <span class="crumb"><a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}<!-- IF navlinks.MICRODATA --> {navlinks.MICRODATA}<!-- ENDIF -->>{navlinks.FORUM_NAME}</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" style="display: none;"><a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}" role="menuitem">{L_SEARCH}</a></li> <!-- 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> diff --git a/phpBB/styles/prosilver/template/notification_dropdown.html b/phpBB/styles/prosilver/template/notification_dropdown.html index db4d5bade7..13d90a9d38 100644 --- a/phpBB/styles/prosilver/template/notification_dropdown.html +++ b/phpBB/styles/prosilver/template/notification_dropdown.html @@ -18,14 +18,17 @@ </li> <!-- ENDIF --> <!-- BEGIN notifications --> - <li class="<!-- IF notifications.UNREAD --> bg2<!-- ENDIF -->"> + <li class="<!-- IF notifications.UNREAD --> bg2<!-- ENDIF --><!-- IF notifications.STYLING --> {notifications.STYLING}<!-- ENDIF --><!-- IF not notifications.URL --> no-url<!-- ENDIF -->"> <!-- IF notifications.URL --> - <a href="<!-- IF notifications.UNREAD -->{notifications.U_MARK_READ}" data-real-url="{notifications.URL}<!-- ELSE -->{notifications.URL}<!-- ENDIF -->"> + <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>{notifications.FORMATTED_TITLE}</p> - <p>» {notifications.TIME}</p> + <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 --> diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index e5371e792e..076a3160f0 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -51,6 +51,8 @@ {$STYLESHEETS} +<!-- EVENT overall_header_stylesheets_after --> + </head> <body id="phpbb" class="nojs notouch section-{SCRIPT_NAME} {S_CONTENT_DIRECTION} {BODY_CLASS}"> @@ -63,7 +65,7 @@ <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> + <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 -->">{SITE_LOGO_IMG}</a> <h1>{SITENAME}</h1> <p>{SITE_DESCRIPTION}</p> <p class="skiplink"><a href="#start_here">{L_SKIP}</a></p> diff --git a/phpBB/styles/prosilver/template/pagination.html b/phpBB/styles/prosilver/template/pagination.html index cde183291d..cb2c09bff7 100644 --- a/phpBB/styles/prosilver/template/pagination.html +++ b/phpBB/styles/prosilver/template/pagination.html @@ -7,7 +7,7 @@ <ul class="dropdown-contents"> <li>{L_JUMP_TO_PAGE}{L_COLON}</li> <li class="page-jump-form"> - <input type="text" name="page-number" maxlength="6" title="{L_SEARCH_KEYWORDS}" class="inputbox tiny" value="" data-per-page="{PER_PAGE}" data-base-url="{BASE_URL|e('html_attr')}" data-start-name="{START_NAME}" /> + <input type="number" name="page-number" 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> diff --git a/phpBB/styles/prosilver/template/posting_attach_body.html b/phpBB/styles/prosilver/template/posting_attach_body.html index 4ad66656b2..81b2c2bf41 100644 --- a/phpBB/styles/prosilver/template/posting_attach_body.html +++ b/phpBB/styles/prosilver/template/posting_attach_body.html @@ -23,7 +23,7 @@ <div class="panel<!-- IF not .attach_row --> hidden<!-- ENDIF -->" 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> diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 081c267a94..25e3be3bcb 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -99,19 +99,21 @@ <!-- 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="<!-- IF SHOW_PANEL -->{SHOW_PANEL}<!-- ELSE -->options-panel<!-- ENDIF -->"> + <div id="tabs" class="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"><strong id="file-total-progress-bar"></strong></strong> </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 --> + <!-- 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 --> </ul> </div> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index d31dd32cf6..0831d5f9dc 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -28,6 +28,8 @@ {$STYLESHEETS} +<!-- EVENT simple_header_stylesheets_after --> + </head> <body id="phpbb" class="nojs {S_CONTENT_DIRECTION} {BODY_CLASS}"> diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options.html b/phpBB/styles/prosilver/template/ucp_avatar_options.html index 4b4581a59c..ca077fdf5b 100644 --- a/phpBB/styles/prosilver/template/ucp_avatar_options.html +++ b/phpBB/styles/prosilver/template/ucp_avatar_options.html @@ -17,7 +17,7 @@ <dl> <dt><label>{L_AVATAR_TYPE}{L_COLON}</label></dt> <dd><select name="avatar_driver" id="avatar_driver" data-togglable-settings="true"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> + <option value="">{L_NO_AVATAR}</option> <!-- BEGIN avatar_drivers --> <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 --> diff --git a/phpBB/styles/prosilver/template/ucp_header.html b/phpBB/styles/prosilver/template/ucp_header.html index 102ea5a3a0..a17f145cbc 100644 --- a/phpBB/styles/prosilver/template/ucp_header.html +++ b/phpBB/styles/prosilver/template/ucp_header.html @@ -5,7 +5,7 @@ <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> @@ -20,7 +20,7 @@ <div style="width: 100%;"> <div id="cp-menu"> - <div id="navigation"> + <div id="navigation" role="navigation"> <!-- IF S_PRIVMSGS --> <!-- BEGIN t_block2 --> diff --git a/phpBB/styles/prosilver/template/ucp_notifications.html b/phpBB/styles/prosilver/template/ucp_notifications.html index 8910769cce..500bae0c47 100644 --- a/phpBB/styles/prosilver/template/ucp_notifications.html +++ b/phpBB/styles/prosilver/template/ucp_notifications.html @@ -65,19 +65,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> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index 84ab6ecb44..489c1c901a 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -38,7 +38,7 @@ <dd class="profile-contact"> <strong>{L_CONTACT}{L_COLON}</strong> <div class="dropdown-container dropdown-left"> - <a href="#" class="dropdown-trigger"><span class="imageset icon_contact"></span></a> + <a href="#" class="dropdown-trigger"><span class="imageset icon_contact" title="{CONTACT_USER}">{CONTACT_USER}</span></a> <div class="dropdown hidden"> <div class="pointer"><div class="pointer-inner"></div></div> <div class="dropdown-contents contact-icons"> @@ -49,7 +49,7 @@ <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, 550, 320); return false;"<!-- ENDIF -->> - <span class="contact-icon {contact.ID}-icon"></span> + <span class="contact-icon {contact.ID}-icon">{contact.NAME}</span> </a> <!-- IF REMAINDER eq 3 or contact.S_LAST_ROW --> </div> @@ -67,6 +67,7 @@ <!-- IF U_DELETE or U_EDIT or U_QUOTE or U_REPORT --> <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 icon-button edit-icon"><span>{L_POST_EDIT_PM}</span></a> @@ -87,6 +88,7 @@ <a href="{U_QUOTE}" title="{L_POST_QUOTE_PM}" class="button icon-button quote-icon"><span>{L_POST_QUOTE_PM}</span></a> </li> <!-- ENDIF --> + <!-- EVENT ucp_pm_viewmessage_post_buttons_after --> </ul> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_prefs_personal.html b/phpBB/styles/prosilver/template/ucp_prefs_personal.html index d07aab1a89..c8b028f83a 100644 --- a/phpBB/styles/prosilver/template/ucp_prefs_personal.html +++ b/phpBB/styles/prosilver/template/ucp_prefs_personal.html @@ -58,8 +58,8 @@ <!-- 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 --> diff --git a/phpBB/styles/prosilver/template/ucp_profile_profile_info.html b/phpBB/styles/prosilver/template/ucp_profile_profile_info.html index c0bf681f47..986bc92298 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_profile_info.html +++ b/phpBB/styles/prosilver/template/ucp_profile_profile_info.html @@ -20,10 +20,12 @@ </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> diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index b27003faab..020f69cb26 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -26,6 +26,7 @@ <!-- 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> @@ -43,8 +44,10 @@ <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> </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> @@ -52,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> @@ -65,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 c44e830b9c..e8c50f79b2 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -1,5 +1,5 @@ <!-- 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 class="forum-title"><!-- EVENT viewforum_forum_name_prepend --><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- EVENT viewforum_forum_name_append --></h2> <!-- IF FORUM_DESC or MODERATORS or U_MCP --> @@ -27,15 +27,15 @@ <!-- 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">{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="action-bar top" <!-- IF S_HAS_SUBFORUM -->style="margin-top: 2em;"<!-- ENDIF -->> + <div class="action-bar top"> <!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO --> <div class="buttons"> @@ -150,6 +150,15 @@ <!-- 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 /> + + <!-- 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.pagination --> <div class="pagination"> <ul> @@ -164,19 +173,13 @@ </ul> </div> <!-- ENDIF --> + <div class="responsive-hide"> <!-- IF topicrow.S_HAS_POLL -->{POLL_IMG} <!-- ENDIF --> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} <!-- IF topicrow.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> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 38836f3ee4..b764979f97 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -1,5 +1,5 @@ <!-- 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 class="topic-title"><!-- EVENT viewtopic_topic_title_prepend --><a href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><!-- EVENT viewtopic_topic_title_append --></h2> <!-- 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 --> @@ -155,7 +155,7 @@ <dd class="profile-contact"> <strong>{L_CONTACT}{L_COLON}</strong> <div class="dropdown-container dropdown-left"> - <a href="#" class="dropdown-trigger"><span class="imageset icon_contact"></span></a> + <a href="#" class="dropdown-trigger"><span class="imageset icon_contact" title="{postrow.CONTACT_USER}">{postrow.CONTACT_USER}</span></a> <div class="dropdown hidden"> <div class="pointer"><div class="pointer-inner"></div></div> <div class="dropdown-contents contact-icons"> @@ -166,7 +166,7 @@ <div> <!-- ENDIF --> <a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{postrow.contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF postrow.contact.ID eq 'jabber' --> onclick="popup(this.href, 550, 320); return false;"<!-- ENDIF -->> - <span class="contact-icon {postrow.contact.ID}-icon"></span> + <span class="contact-icon {postrow.contact.ID}-icon">{postrow.contact.NAME}</span> </a> <!-- IF REMAINDER eq 3 or postrow.contact.S_LAST_ROW --> </div> @@ -350,6 +350,21 @@ <!-- INCLUDE viewtopic_topic_tools.html --> + <!-- IF .quickmod --> + <div class="dropdown-container dropdown-container-{S_CONTENT_FLOW_BEGIN} dropdown-up dropdown-{S_CONTENT_FLOW_END} dropdown-button-control" id="quickmod"> + <span title="{L_QUICK_MOD}" class="dropdown-trigger button icon-button modtools-icon dropdown-select">{L_QUICK_MOD}</span> + <div class="dropdown hidden"> + <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 --> + <!-- IF .pagination or TOTAL_POSTS --> <div class="pagination"> {TOTAL_POSTS} @@ -366,21 +381,6 @@ <!-- 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 --> <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> diff --git a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html index 5394c00f6a..2a34ebd446 100644 --- a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html +++ b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html @@ -7,16 +7,12 @@ <!-- 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}" class="watch-topic-link" 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}" data-update-all=".watch-topic-link"> - {S_WATCH_TOPIC_TITLE} - </a> + <a href="{U_WATCH_TOPIC}" class="watch-topic-link" 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}" data-update-all=".watch-topic-link">{S_WATCH_TOPIC_TITLE}</a> </li> <!-- ENDIF --> <!-- IF U_BOOKMARK_TOPIC --> <li class="small-icon icon-bookmark"> - <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"> - {S_BOOKMARK_TOPIC} - </a> + <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">{S_BOOKMARK_TOPIC}</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 --> diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index f3902b363d..d3594cc5bd 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,7 +20,7 @@ /* Main blocks ---------------------------------------- */ -.rtl #logo { +.rtl .logo { float: right; padding: 10px 10px 0 13px; } @@ -59,20 +59,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,11 +92,16 @@ /* Bulletin icons for list items ----------------------------------------*/ -.rtl ul.linklist.bulletin li:before { +.rtl ul.linklist.bulletin > li:before { padding-left: 4px; padding-right: 0; } +.rtl ul.linklist li.responsive-menu a.responsive-menu-link:before { + left: auto; + right: 0; +} + /* Dropdown menu ---------------------------------------- */ .rtl .dropdown-container.topic-tools { @@ -109,7 +114,37 @@ .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 { + 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 @@ -154,7 +189,7 @@ /* Misc layout styles ---------------------------------------- */ -/* column[1-2] styles are containers for two column layouts +/* column[1-2] styles are containers for two column layouts Also see tweaks.css */ .rtl .column1 { float: right; @@ -250,12 +285,15 @@ text-align: left; } -.rtl .forabg { - width: 99%; /* fix for IE6 */ +.rtl #quick-links { + margin-left: 7px; + margin-right: 0; } -.rtl .forumbg { - width: 99%; /* fix for IE6 */ +.rtl .header-avatar span:after { + float: left; + padding-left: 0; + padding-right: 2px; } .rtl .member-search { @@ -277,7 +315,7 @@ 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; } @@ -317,7 +355,7 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { .rtl ul.topiclist.missing-column dt { margin-right: 0; - margin-left: -330px; + margin-left: -345px; } .rtl ul.topiclist.two-long-columns dt { @@ -350,10 +388,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; @@ -402,14 +436,10 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { } .rtl dl.icon dt .list-inner { - padding-left: 0; + padding-left: 5px; padding-right: 45px; /* Space for folder icon */ } -.rtl dl.icon dt { /* fix for topic row icon links */ - position: relative; -} - .rtl dl a.icon-link { /* topic row icon links */ display: inline-block; left: auto; @@ -418,7 +448,7 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { 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 { +.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; } @@ -598,11 +628,11 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { ---------------------------------------- */ .rtl .small-icon { background-position: 100% 50%; - padding: 0 19px 0 0; } -.rtl ul.linklist li.small-icon { - padding-right: 0; +.rtl .small-icon > a { + padding-left: 0; + padding-right: 19px; } /* Post control buttons @@ -619,6 +649,19 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { margin-right: 0; } +/* Poster contact icons + ----------------------------------------*/ +.rtl .contact-icons a { + border-left-width: 1px; + border-left-style: dotted; + border-right: none; + float: right; +} + +.rtl .contact-icons .last-cell { + border-left: none; +} + /** * cp.css */ @@ -653,34 +696,63 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { /* CP tabbed menu ----------------------------------------*/ .rtl #tabs { - margin: 20px 7px -1px 0; + 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 { + 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 ----------------------------------------*/ @@ -731,6 +803,15 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { 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 */ @@ -878,10 +959,6 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { } /* 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; @@ -906,3 +983,104 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { padding-right: 16px; padding-left: 0; } + +/** +* plupload.css +*/ + +.rtl .attach-controls { + float: left; +} + +/** +* 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; + } + + @media only screen and (max-width: 550px), only screen and (max-device-width: 550px) + { + .rtl ul.topiclist.forums dt { + margin-left: 0; + } + + .rtl ul.topiclist.forums dt .list-inner { + margin-left: 0; + } + } + + .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; + } + + @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; + } + } + + /* Post + ----------------------------------------*/ + .rtl .postprofile, .rtl .postbody, .rtl .search .postbody { + float: none; + } + + .rtl .post .postprofile { + border-width: 0 0 1px 0; + } + + .rtl .postprofile .avatar { + float: right; + margin-left: 5px; + margin-right: 0; + } +} diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css index 19cb547bd4..b45aae5672 100644 --- a/phpBB/styles/prosilver/theme/buttons.css +++ b/phpBB/styles/prosilver/theme/buttons.css @@ -21,8 +21,8 @@ vertical-align: bottom; } -.icon-button.dropdown-select { - padding-right: 28px; +.dropdown-select { + padding-right: 24px; } .icon-button:before { @@ -35,6 +35,10 @@ width: 12px; } +.dropdown-select.icon-button:before { + margin-right: 4px; +} + .dropdown-select:after { background-position: -103px 10px; border-left: 1px solid; @@ -58,6 +62,10 @@ margin-right: 5px; } +#jumpbox .dropdown-select { + margin: 0; +} + /* Big button images */ .reply-icon:before, .pmreply-icon:before { background-position: -20px 0; } .reply-icon:hover:before, .pmreply-icon:hover:before { background-position: -20px -20px; } @@ -73,7 +81,11 @@ .forwardpm-icon:before { background-position: -40px 0; } .forwardpm-icon:hover:before { background-position: -40px -20px; } -.tools-icon:before { +.modtools-icon { + font-size: 0; +} + +.tools-icon:before, .modtools-icon:before { background-position: -80px 0; height: 16px; margin-top: 2px; @@ -83,28 +95,37 @@ .dropdown-visible .tools-icon:before, .nojs .dropdown-container:hover .tools-icon:before { background-position: -80px -20px; } +.modtools-icon:before { background-position: -225px 0; } +.dropdown-visible .modtools-icon:before, +.nojs .dropdown-container:hover .modtools-icon:before { background-position: -225px -20px; } + /* Icon images ---------------------------------------- */ .small-icon { background-position: 0 50%; background-repeat: no-repeat; background-image: none; - padding: 0 0 0 17px; } -ul.linklist li.small-icon { - padding-left: 0; +.small-icon > a { + display: inline-block; + padding: 0 0 0 18px; } -ul.linklist.bulletin li.small-icon:before { +ul.linklist.bulletin > li.small-icon:before { display: none; } +.dropdown .small-icon > a { + display: block; +} + /* Poster contact icons ----------------------------------------*/ .contact-icons.dropdown-contents { min-width: 0; padding: 0; + font-size: 0; } .contact-icon { @@ -143,7 +164,7 @@ ul.linklist.bulletin li.small-icon:before { .phpbb_website-icon { background-position: -40px 0; } .phpbb_youtube-icon { background-position: -98px 0; } .phpbb_facebook-icon { background-position: -119px 0; } -.phpbb_google_plus-icon { background-position: -140px 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; } @@ -156,7 +177,7 @@ ul.linklist.bulletin li.small-icon:before { margin-top: 2px; } -.post-buttons li { +.post-buttons > li { float: left; margin-right: 3px; } diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 875e61020b..82542c8d86 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 { @@ -43,6 +43,11 @@ hr { /* Round cornered boxes and backgrounds ---------------------------------------- */ +#wrap { + background-color: #FFF; + border-color: #E6E9ED; +} + .headerbar { background-color: #12A3EB; background-image: url("./images/bg_header.gif"); @@ -106,7 +111,7 @@ table.zebra-list tr:nth-child(even) td, ul.zebra-list li:nth-child(even) { ----------------------------------------*/ ul.navlinks { - border-bottom-color: #FFFFFF; + border-top-color: #FFFFFF; } /* Table styles @@ -223,15 +228,15 @@ p.post-notice { background-image: none; } -p.post-notice.deleted:before { +p.post-notice.deleted:before { background-image: url("./images/icon_topic_deleted.png"); } -p.post-notice.unapproved:before { +p.post-notice.unapproved:before { background-image: url("./images/icon_topic_unapproved.gif"); } -p.post-notice.reported:before, p.post-notice.error:before { +p.post-notice.reported:before, p.post-notice.error:before { background-image: url("./images/icon_topic_reported.gif"); } @@ -241,16 +246,10 @@ Colours and backgrounds for links.css -------------------------------------------------------------- */ a { 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 { - color: #FFFFFF; -} - -#search-box a:visited, .navbg a:visited, .forumbg .header a:visited, .forabg .header a:visited, th a:visited { +#search-box a, .navbg a, .forumbg .header a, .forabg .header a, th a { color: #FFFFFF; } @@ -258,44 +257,11 @@ a:active { color: #368AD2; } color: #A8D8FF; } -#search-box a:active, .navbg a:active, .forumbg .header a:active, .forabg .header a:active, th a:active { - color: #C8E6FF; -} - /* Notification mark read link */ .dropdown-extended a.mark_read { background-color: #FFFFFF; } -/* Links for forum/topic lists */ -a.forumtitle { - color: #105289; -} - -/* a.forumtitle:visited { color: #105289; } */ - -a.forumtitle:hover { - color: #BC2A4D; -} - -a.forumtitle:active { - color: #105289; -} - -a.topictitle { - color: #105289; -} - -/* a.topictitle:visited { color: #368AD2; } */ - -a.topictitle:hover { - color: #BC2A4D; -} - -a.topictitle:active { - color: #105289; -} - /* Post body links */ .postlink { color: #368AD2; @@ -307,41 +273,15 @@ a.topictitle:active { 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 { +.signature a, .signature a:hover { 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"); @@ -369,7 +309,6 @@ a.arrow-right:hover { color: #368AD2; } - /* -------------------------------------------------------------- Colours and backgrounds for content.css @@ -658,7 +597,7 @@ dd.profile-warnings { -------------------------------------------------------------- Colours and backgrounds for buttons.css -------------------------------------------------------------- */ -.button, .button:visited { +.button { border-color: #C7C3BF; background-color: #FFFFFF; background-image: -moz-linear-gradient(top, #FFFFFF, #E9E9E9); @@ -668,7 +607,11 @@ Colours and backgrounds for buttons.css -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; + color: #D31141; +} + +.dropdown-select, .dropdown-select:visited { + color: #536482; } .button:hover, .dropdown-visible .dropdown-select, .nojs .dropdown-container:hover .dropdown-select { @@ -694,24 +637,36 @@ Colours and backgrounds for buttons.css /* 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-acp { background-image: url("./images/icon_acp.gif"); } +.icon-bookmark { background-image: url("./images/icon_bookmark.gif"); } +.icon-bump { background-image: url("./images/icon_bump.gif"); } +.icon-contact { background-image: url("./images/icon_pm.gif"); } +.icon-delete-cookies { background-image: url("./images/icon_delete_cookies.gif"); } +.icon-download { background-image: url("./images/icon_download.gif"); } +.icon-faq { background-image: url("./images/icon_faq.gif"); } +.icon-home { background-image: url("./images/icon_home.gif"); } +.icon-logout { background-image: url("./images/icon_logout.gif"); } +.icon-mark { background-image: url("./images/icon_mark.gif"); } +.icon-mcp { background-image: url("./images/icon_mcp.gif"); } +.icon-members { background-image: url("./images/icon_members.gif"); } +.icon-notification { background-image: url("./images/icon_notification.gif"); } +.icon-pages { background-image: url("./images/icon_pages.gif"); } +.icon-pm { background-image: url("./images/icon_pm.gif"); } +.icon-print { background-image: url("./images/icon_print.gif"); } +.icon-profile { background-image: url("./images/icon_profile.gif"); } +.icon-register { background-image: url("./images/icon_register.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"); } -.icon-sendemail { background-image: url("./images/icon_sendemail.gif"); } -.icon-print { background-image: url("./images/icon_print.gif"); } +.icon-search-active { background-image: url("./images/subforum_read.gif"); } +.icon-search-advanced { background-image: url("./images/icon_search_adv.gif"); } +.icon-search-new { background-image: url("./images/subforum_unread.gif"); } +.icon-search-self { background-image: url("./images/icon_topic_latest.gif"); } +.icon-search-unanswered { background-image: url("./images/icon_post_target.gif"); } +.icon-search-unread { background-image: url("./images/subforum_unread.gif"); } +.icon-sendemail { background-image: url("./images/icon_sendemail.gif"); } +.icon-subscribe { background-image: url("./images/icon_subscribe.gif"); } +.icon-team { background-image: url("./images/icon_team.gif"); } +.icon-ucp { background-image: url("./images/icon_ucp.gif"); } +.icon-unsubscribe { background-image: url("./images/icon_unsubscribe.gif"); } /* Profile & navigation icons */ .contact-icon { background-image: url("./images/icons_contact.png"); } @@ -807,53 +762,55 @@ ul.cplist { /* 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: #CADCEB; + background: -moz-linear-gradient(top, #E2F2FF 0%, #CADCEB 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #E2F2FF), color-stop(100%, #CADCEB)); + background: -webkit-linear-gradient(top, #E2F2FF 0%, #CADCEB 100%); + background: -o-linear-gradient(top, #E2F2FF 0%, #CADCEB 100%); + background: -ms-linear-gradient(top, #E2F2FF 0%, #CADCEB 100%); + background: linear-gradient(to bottom, #E2F2FF 0%, #CADCEB 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#E2F2FF', endColorstr='#CADCEB', GradientType=0 ); + 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 @@ -862,35 +819,47 @@ ul.cplist { /* Link styles for the sub-section links */ #navigation a { color: #333; - background-color: #B2C2CF; - background-image: url("./images/bg_menu.gif"); + background: #B4C4D1; + background: -moz-linear-gradient(left, #B4C4D1 50%, #CADCEB 100%); + background: -webkit-gradient(left top, right top, color-stop(50%, #B4C4D1), color-stop(100%, #CADCEB)); + background: -webkit-linear-gradient(left, #B4C4D1 50%, #CADCEB 100%); + background: -o-linear-gradient(left, #B4C4D1 50%, #CADCEB 100%); + background: -ms-linear-gradient(left, #B4C4D1 50%, #CADCEB 100%); + background: linear-gradient(to right, #B4C4D1 50%, #CADCEB 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#B4C4D1', endColorstr='#CADCEB', GradientType=1 ); } .rtl #navigation a { - background-image: url("./images/bg_menu_rtl.gif"); - background-position: 0 100%; + background: #B4C4D1; + background: -moz-linear-gradient(left, #CADCEB 0%, #B4C4D1 50%); + background: -webkit-gradient(left top, right top, color-stop(0%, #CADCEB), color-stop(50%, #B4C4D1)); + background: -webkit-linear-gradient(left, #CADCEB 0%, #B4C4D1 50%); + background: -o-linear-gradient(left, #CADCEB 0%, #B4C4D1 50%); + background: -ms-linear-gradient(left, #CADCEB 0%, #B4C4D1 50%); + background: linear-gradient(to right, #CADCEB 0%, #B4C4D1 50%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#CADCEB', endColorstr='#B4C4D1', GradientType=1 ); } #navigation a:hover { - background-image: none; - background-color: #aabac6; + background: #AABAC6; color: #BC2A4D; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } #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 { 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; } } @@ -1065,7 +1034,7 @@ 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; } @@ -1108,7 +1077,7 @@ input.disabled { } .dropdown-extended ul li { - border-bottom-color: #B9B9B9; + border-top-color: #B9B9B9; } .dropdown-extended ul li:hover { @@ -1144,7 +1113,7 @@ input.disabled { border-color: #FFF transparent; } -.dropdown-extended .pointer-inner, #minitabs .pointer-inner { +.dropdown-extended .pointer-inner { border-color: #F1F8FF transparent; } @@ -1170,6 +1139,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 aa28cd6962..54d81406e8 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -175,8 +175,18 @@ ol ol ul, ol ul ul, ul ol ul, ul ul ul { /* Main blocks ---------------------------------------- */ #wrap { - padding: 0 20px; - min-width: 650px; + border: 1px solid transparent; + border-radius: 8px; + margin: 0 auto; + max-width: 1152px; + min-width: 625px; + padding: 15px; +} + +@media only screen and (max-width: 1220px), only screen and (max-device-width: 1220px) { + #wrap { + margin: 0 12px; + } } #simple-wrap { @@ -196,13 +206,13 @@ ol ol ul, ol ul ul, ul ol ul, ul ul ul { margin-top: 20px; } -#logo { +.logo { float: left; width: auto; padding: 10px 13px 0 10px; } -a#logo:hover { +.logo:hover { text-decoration: none; } @@ -261,7 +271,7 @@ a#logo:hover { } .navbar { - padding: 5px 10px 5px 10px; + padding: 3px 10px; border-radius: 7px; } @@ -307,6 +317,10 @@ a#logo:hover { /* Horizontal lists ----------------------------------------*/ +.navbar ul.linklist { + padding: 2px 0; +} + ul.linklist { display: block; margin: 0; @@ -322,29 +336,25 @@ ul.linklist:after { 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 { @@ -372,7 +382,7 @@ ul.linklist li.responsive-menu a.responsive-menu-link { font-size: 16px; position: relative; width: 16px; - line-height: 16.5px; + line-height: 20px; text-decoration: none; } @@ -403,27 +413,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,11 +432,12 @@ ul.linklist.bulletin li:before { padding-right: 4px; } -ul.linklist.bulletin li:first-child:before, ul.linklist.bulletin li.rightside:last-child:before { +ul.linklist.bulletin > li:first-child:before, +ul.linklist.bulletin > li.rightside:last-child:before { content: none; } -ul.linklist.bulletin li.no-bulletin:before { +ul.linklist.bulletin > li.no-bulletin:before { content: none; } @@ -443,20 +445,46 @@ ul.linklist.bulletin li.no-bulletin:before { display: none !important; } -/* Avatar in overall_header.html */ +/* 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: 25px; + max-height: 20px; vertical-align: middle; width: auto; } +.header-avatar span:after { + content: '\25BC'; + display: inline-block; + font-size: 9px; + float: right; + padding-left: 2px; + opacity: 0.7; +} + /* Dropdown menu ----------------------------------------*/ .dropdown-container { position: relative; } +.dropdown-container-right { + float: right; +} + +.dropdown-container-left { + float: left; +} + .nojs .dropdown-container:hover .dropdown { display: block !important; } @@ -556,14 +584,14 @@ ul.linklist.bulletin li.no-bulletin:before { padding: 5px; position: relative; min-width: 40px; - max-height: 200px; + max-height: 300px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .dropdown li { - border-bottom: 1px dotted transparent; + border-top: 1px dotted transparent; float: none !important; line-height: normal !important; font-size: 1em !important; @@ -575,8 +603,16 @@ ul.linklist.bulletin li.no-bulletin:before { 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 { @@ -589,14 +625,20 @@ 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, .dropdown-extended li { white-space: normal; } -.dropdown li:before, .dropdown li:after { +.dropdown li.separator { + border-top: 1px solid transparent; + margin: 4px 0; + padding: 0; +} + +.dropdown li.separator:first-child, .dropdown li.separator:last-child { display: none !important; } @@ -604,6 +646,7 @@ ul.linklist.bulletin li.no-bulletin:before { ----------------------------------------*/ .breadcrumbs .crumb { float: left; + font-weight: bold; word-wrap: normal; } @@ -809,6 +852,10 @@ fieldset.fields1 dl.pmlist dd.recipients { margin: 4px 0; } +.forabg + .action-bar { + margin-top: 2em; +} + .action-bar:after { clear: both; content: ''; @@ -912,14 +959,14 @@ fieldset.fields1 dl.pmlist dd.recipients { .phpbb_alert { border: 1px solid transparent; display: none; - left: 0; + left: 0; padding: 0 25px 20px 25px; position: fixed; - right: 0; + right: 0; top: 150px; z-index: 50; width: 620px; - margin: 0 auto; + margin: 0 auto; } @media only screen and (max-height: 500px), only screen and (max-device-width: 500px) @@ -1062,6 +1109,14 @@ form > p.post-notice strong { line-height: 20px; } +#jumpbox { + margin: 5px 0; +} + +.stat-block { + clear: both; +} + #top { position: absolute; top: -20px; @@ -1099,11 +1154,7 @@ form > p.post-notice strong { .dropdown-extended { display: none; - position: absolute; - left: 0; - width: 330px; z-index: 1; - top: 22px; } .dropdown-extended ul { @@ -1115,26 +1166,32 @@ form > p.post-notice strong { .dropdown-extended ul li { padding: 0; - margin: 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; } -.dropdown-extended ul li.no_notifications { - padding: 10px; +.dropdown-extended ul li:first-child { + border-top: none; } -.dropdown-extended ul li:before, .dropdown-extended ul li:after { - display: none; +.dropdown-extended ul li.no_notifications { + padding: 10px; } .dropdown-extended .dropdown-contents { max-height: none; padding: 0; + position: absolute; + width: 340px; +} + +.nojs .dropdown-extended .dropdown-contents { + position: relative; } .dropdown-extended .header { @@ -1142,8 +1199,9 @@ form > p.post-notice strong { 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; + text-transform: uppercase; line-height: 30px; border-bottom: 1px solid; border-radius: 5px 5px 0 0; @@ -1160,8 +1218,8 @@ form > p.post-notice strong { font-size: 1.1em; } -.dropdown-extended ul li a{ - padding: 10px; +.dropdown-extended ul li a, .dropdown-extended ul li.no-url { + padding: 8px; } .dropdown-extended .footer > a { @@ -1176,28 +1234,55 @@ 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: 0; + 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: 10px; + 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; +} + +.notification_list p.notifications_title strong { font-weight: bold; } .notification_list p.notifications_time { - font-size: 11px !important; + font-size: 10px !important; +} + +.notification_text { + margin-left: 58px; } .notification_text:after { @@ -1206,6 +1291,30 @@ form > p.post-notice strong { display: block; } +/* Navbar specific list items +----------------------------------------*/ + +#quick-links { + margin: 0 7px 0 0; +} + +#quick-links a.responsive-menu-link { + display: block; + font-size: inherit; + line-height: inherit; + margin: 0; + width: auto; +} + +#quick-links a.responsive-menu-link:before { + font-size: 16px; + line-height: 16.5px; +} + +.compact #quick-links a.responsive-menu-link { + font-size: 0; +} + .compact .icon-notification > a > span, .compact .icon-pm > a > span { display: none; } @@ -1225,3 +1334,19 @@ form > p.post-notice strong { .dropdown-page-jump input.tiny { width: 50px; } + +.dropdown .clone { + display: none; +} + +.responsive .dropdown .clone { + display: inherit; +} + +.dropdown .clone + li.separator { + display: none; +} + +.responsive .dropdown .clone + li.separator { + display: inherit; +} diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 9d87d3217f..a014f57d47 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -210,7 +210,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; } @@ -267,7 +267,7 @@ dd.option { } .postbody img.postimage { - max-width: 99%; + max-width: 100%; } .search .postbody { @@ -351,10 +351,6 @@ dd.option { 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; @@ -462,7 +458,7 @@ blockquote { blockquote blockquote { /* Nested quotes */ font-size: 1em; - margin: 0.5em 1px 0 15px; + margin: 0.5em 1px 0 15px; } blockquote cite { @@ -519,7 +515,7 @@ blockquote .codebox { ----------------------------------------*/ .attachbox { float: left; - width: auto; + width: auto; max-width: 100%; margin: 5px 5px 5px 0; padding: 6px; @@ -596,12 +592,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 { @@ -734,14 +731,16 @@ dd.profile-contact { .profile-contact .dropdown-container { display: inline-block; - text-align: left; - width: 30px; } .profile-contact .icon_contact { vertical-align: middle; } +.profile-contact .dropdown { + margin-right: -14px; +} + .online { background-image: none; background-position: 100% 0; @@ -801,6 +800,10 @@ div.dl_links { 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, .dropdown-extended ul::-webkit-scrollbar { diff --git a/phpBB/styles/prosilver/theme/cp.css b/phpBB/styles/prosilver/theme/cp.css index 452c2c625e..5149a16ec9 100644 --- a/phpBB/styles/prosilver/theme/cp.css +++ b/phpBB/styles/prosilver/theme/cp.css @@ -97,117 +97,82 @@ ul.cplist { } .tabs-container:after { - display: block; clear: both; content: ''; + display: block; } -/* 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 { +#tabs > ul:after, #minitabs > ul:after { + clear: both; content: ''; display: block; - clear: both; } -#tabs li { - display: inline; - margin: 0; - padding: 0; +#tabs .tab, #minitabs .tab { + display: inline-block; + float: left; font-size: 1em; font-weight: bold; + line-height: 14px; } -#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 { 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; } @@ -217,8 +182,8 @@ ul.cplist { 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; @@ -226,80 +191,41 @@ ul.cplist { 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; + top: 20px; + margin-right: -2px; + font-size: 1.1em; + font-weight: normal; } #minitabs .dropdown { - top: 18px; + margin-right: -4px; } #tabs .dropdown-up .dropdown, #minitabs .dropdown-up .dropdown { - bottom: -5px; + 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 */ @@ -309,15 +235,15 @@ ul.cplist { } #navigation ul { - list-style:none; + list-style: none; } /* Default list state */ #navigation li { + display: inline; + font-weight: bold; margin: 1px 0; padding: 0; - font-weight: bold; - display: inline; } /* Link styles for the sub-section links */ @@ -326,18 +252,10 @@ ul.cplist { padding: 5px; margin: 1px 0; text-decoration: none; - font-weight: bold; - background: transparent none repeat-y 100% 0; } #navigation a:hover { text-decoration: none; - background-image: none; -} - -#navigation #active-subsection a { - display: block; - background-image: none; } /* Preferences pane layout @@ -403,7 +321,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 { @@ -436,7 +354,7 @@ 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; + max-width: 40px; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.5px; @@ -448,8 +366,8 @@ ol.def-rules li { margin: 0; } - #navigation { - padding: 0; + #navigation { + padding: 0; margin: 0 auto; max-width: 320px; } diff --git a/phpBB/styles/prosilver/theme/forms.css b/phpBB/styles/prosilver/theme/forms.css index 0c0a3e5ca9..f0effa01c4 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; @@ -201,24 +201,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; @@ -294,6 +276,10 @@ textarea.inputbox { width: auto !important; } +input[type="number"] { + -moz-padding-end: inherit; +} + input[type="search"] { -webkit-appearance: textfield; -webkit-box-sizing: content-box; @@ -331,8 +317,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 */ 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/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/icon_acp.gif b/phpBB/styles/prosilver/theme/images/icon_acp.gif Binary files differnew file mode 100644 index 0000000000..3afa98ee8f --- /dev/null +++ b/phpBB/styles/prosilver/theme/images/icon_acp.gif diff --git a/phpBB/styles/prosilver/theme/images/icon_delete_cookies.gif b/phpBB/styles/prosilver/theme/images/icon_delete_cookies.gif Binary files differnew file mode 100644 index 0000000000..f7665ebff8 --- /dev/null +++ b/phpBB/styles/prosilver/theme/images/icon_delete_cookies.gif diff --git a/phpBB/styles/prosilver/theme/images/icon_mcp.gif b/phpBB/styles/prosilver/theme/images/icon_mcp.gif Binary files differnew file mode 100644 index 0000000000..80de2e53f7 --- /dev/null +++ b/phpBB/styles/prosilver/theme/images/icon_mcp.gif diff --git a/phpBB/styles/prosilver/theme/images/icon_profile.gif b/phpBB/styles/prosilver/theme/images/icon_profile.gif Binary files differnew file mode 100644 index 0000000000..a0ec098460 --- /dev/null +++ b/phpBB/styles/prosilver/theme/images/icon_profile.gif diff --git a/phpBB/styles/prosilver/theme/images/icon_team.gif b/phpBB/styles/prosilver/theme/images/icon_team.gif Binary files differnew file mode 100644 index 0000000000..613158257b --- /dev/null +++ b/phpBB/styles/prosilver/theme/images/icon_team.gif diff --git a/phpBB/styles/prosilver/theme/images/icons_button.png b/phpBB/styles/prosilver/theme/images/icons_button.png Binary files differindex a45a0cc2ba..da9ae6f1b4 100644 --- a/phpBB/styles/prosilver/theme/images/icons_button.png +++ b/phpBB/styles/prosilver/theme/images/icons_button.png diff --git a/phpBB/styles/prosilver/theme/links.css b/phpBB/styles/prosilver/theme/links.css index 86cdf9c10e..9b5c00d9b6 100644 --- a/phpBB/styles/prosilver/theme/links.css +++ b/phpBB/styles/prosilver/theme/links.css @@ -5,19 +5,10 @@ a { direction: ltr; unicode-bidi: embed; -} - -a:link, a:visited { text-decoration: none; } -a:hover { - text-decoration: underline; -} - -a:active { - text-decoration: none; -} +a:hover { text-decoration: underline; } /* Coloured usernames */ .username-coloured { @@ -27,11 +18,7 @@ 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 { +#search-box a, .navbg a, .forumbg .header a, .forabg .header a, th a { text-decoration: none; } @@ -39,12 +26,8 @@ a:active { 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 { +li.breadcrumbs span:first-child > a { display: inline-block; padding-left: 17px; } @@ -62,6 +45,9 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { top: 50%; width: 30px; height: 40px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } .dropdown-extended li:hover a.mark_read { @@ -115,13 +101,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,22 +116,14 @@ 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; } /* Back to top of page */ @@ -179,7 +157,7 @@ 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 { +a.arrow-up { padding-left: 10px; text-decoration: none; border-bottom-width: 0; @@ -189,7 +167,7 @@ a.arrow-up:hover { background-position: left top; } -a.arrow-down, a.arrow-down:link, a.arrow-down:active, a.arrow-down:visited { +a.arrow-down { padding-right: 10px; } @@ -198,7 +176,7 @@ a.arrow-down:hover { text-decoration: none; } -a.arrow-left, a.arrow-left:active, a.arrow-left:visited { +a.arrow-left { padding-left: 12px; } @@ -207,7 +185,7 @@ a.arrow-left:hover { background-position: 0 60%; } -a.arrow-right, a.arrow-right:active, a.arrow-right:visited { +a.arrow-right { padding-right: 12px; } diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index 88de620493..34129c92e8 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -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 7117e2c435..241b4d132e 100644 --- a/phpBB/styles/prosilver/theme/responsive.css +++ b/phpBB/styles/prosilver/theme/responsive.css @@ -13,12 +13,15 @@ html { } body { - padding: 0 5px; + padding: 0; } #wrap { - min-width: 300px; - padding: 0; + border: none; + border-radius: 0; + margin: 0; + min-width: 290px; + padding: 0 5px; } /* Common block wrappers @@ -41,7 +44,7 @@ body { text-align: center; } -#logo { +.logo { /* change display value to inline-block to show logo */ display: none; float: none; @@ -73,7 +76,7 @@ body { .responsive-search a { display: block; width: 16px; - height: 18px; + height: 22px; text-indent: 99px; overflow: hidden; background-position: 50% 50%; @@ -119,23 +122,23 @@ ul.topiclist li.header dt .list-inner { min-height: 0; } -ul.topiclist dd { - display: none; +ul.topiclist dd { + display: none; } -ul.topiclist dd.mark { - display: block; +ul.topiclist dd.mark { + display: block; } /* Forums and topics lists ----------------------------------------*/ -ul.topiclist.forums dt, ul.topiclist.topics dt { +ul.topiclist.forums dt { margin-right: -250px; } -ul.topiclist.forums dt .list-inner, ul.topiclist.topics dt .list-inner { +ul.topiclist.forums dt .list-inner { margin-right: 250px; } -ul.topiclist.forums dd.lastpost, ul.topiclist.topics dd.lastpost { +ul.topiclist.forums dd.lastpost { display: block; } @@ -160,15 +163,15 @@ ul.topiclist.forums dd.topics dfn, ul.topiclist.topics dd.posts dfn { @media only screen and (max-width: 550px), only screen and (max-device-width: 550px) { - ul.topiclist.forums dt, ul.topiclist.topics dt { + 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; } } @@ -190,8 +193,8 @@ ul.topiclist li.row dt a.subforum { ----------------------------------------*/ @media only screen and (max-width: 350px), only screen and (max-device-width: 350px) { - .dropdown-extended { - width: 250px; + .dropdown-extended .dropdown-contents { + width: auto; } } @@ -201,8 +204,8 @@ ul.topiclist li.row dt a.subforum { margin: 5px 0 0; } -.row .pagination > ul { - margin-top: 0; +.row .pagination .ellipsis + li { + display: none !important; } /* Responsive tables @@ -367,7 +370,7 @@ fieldset.quick-login label[for="autologin"] { dl.details dt, dl.details dd { width: auto; float: none; - text-align: left; + text-align: left; } dl.details dd { @@ -457,11 +460,6 @@ p.rightside { margin-bottom: 0; } -.column1, .column2 { - width: auto; - float: none; -} - fieldset.quickmod { width: auto; float: none; diff --git a/phpBB/styles/prosilver/theme/tweaks.css b/phpBB/styles/prosilver/theme/tweaks.css index 9a8ed5d399..ea0c66d20a 100644 --- a/phpBB/styles/prosilver/theme/tweaks.css +++ b/phpBB/styles/prosilver/theme/tweaks.css @@ -1,6 +1,6 @@ /* Style Sheet Tweaks -These style definitions are IE 7 and 8 specific +These style definitions are IE 7 and 8 specific tweaks required due to its poor CSS support. -------------------------------------------------*/ @@ -14,9 +14,9 @@ ul.linklist { } /* Align checkboxes/radio buttons nicely */ -dd label input { - vertical-align: text-bottom; - *vertical-align: middle; +dd label input { + vertical-align: text-bottom; + *vertical-align: middle; } /* Simple fix so forum and topic lists always have a height set */ @@ -69,5 +69,5 @@ dd.option { /* Fixes header-avatar aspect-ratio in IE8 */ .header-avatar img { - height: 25px; + height: 20px; } diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index b9e77bfb4f..633acf66e0 100644 --- a/phpBB/styles/subsilver2/style.cfg +++ b/phpBB/styles/subsilver2/style.cfg @@ -21,8 +21,8 @@ # General Information about this style name = subsilver2 copyright = © 2005 phpBB Limited -style_version = 3.1.0-b4 -phpbb_version = 3.1.0-b4 +style_version = 3.1.0-RC2 +phpbb_version = 3.1.0-RC2 # Defining a different template bitfield # template_bitfield = lNg= diff --git a/phpBB/styles/subsilver2/template/breadcrumbs.html b/phpBB/styles/subsilver2/template/breadcrumbs.html index 646525c206..25387da832 100644 --- a/phpBB/styles/subsilver2/template/breadcrumbs.html +++ b/phpBB/styles/subsilver2/template/breadcrumbs.html @@ -2,8 +2,10 @@ <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 --><!-- EVENT overall_header_navlink_prepend --> » <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}>{navlinks.FORUM_NAME}</a><!-- EVENT overall_header_navlink_append --><!-- END navlinks --> - <!-- EVENT overall_header_breadcrumb_append --></p> + <!-- EVENT overall_header_breadcrumbs_before --> + <p class="breadcrumbs"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}"{$MICRODATA} data-navbar-reference="home">{L_SITE_HOME}</a> <strong>»</strong> <!-- ENDIF --><!-- IF $OVERALL_HEADER_BREADCRUMBS --><!-- EVENT overall_header_breadcrumb_prepend --><!-- ELSE --><!-- EVENT overall_footer_breadcrumb_prepend --><!-- ENDIF --><a href="{U_INDEX}"{$MICRODATA} data-navbar-reference="index">{L_INDEX}</a><!-- BEGIN navlinks --><!-- EVENT overall_header_navlink_prepend --> » <a href="{navlinks.U_VIEW_FORUM}"{$MICRODATA}<!-- IF navlinks.MICRODATA --> {navlinks.MICRODATA}<!-- ENDIF -->>{navlinks.FORUM_NAME}</a><!-- EVENT overall_header_navlink_append --><!-- END navlinks --> + <!-- IF $OVERALL_HEADER_BREADCRUMBS --><!-- EVENT overall_header_breadcrumb_append --><!-- ELSE --><!-- EVENT overall_footer_breadcrumb_append --><!-- ENDIF --></p> + <!-- EVENT overall_header_breadcrumbs_after --> <!-- EVENT overall_footer_timezone_before --> <p class="datetime">{S_TIMEZONE}</p> <!-- EVENT overall_footer_timezone_after --> diff --git a/phpBB/styles/subsilver2/template/index_body.html b/phpBB/styles/subsilver2/template/index_body.html index 2fdd0c77c1..1a2786015f 100644 --- a/phpBB/styles/subsilver2/template/index_body.html +++ b/phpBB/styles/subsilver2/template/index_body.html @@ -1,6 +1,6 @@ <!-- INCLUDE overall_header.html --> -<!-- EVENT index_body_linklist_before --> +<!-- EVENT index_body_markforums_before --> <!-- IF U_MCP or U_ACP --> <div id="pageheader"> @@ -10,7 +10,7 @@ <br clear="all" /><br /> <!-- ENDIF --> -<!-- EVENT index_body_linklist_after --> +<!-- EVENT index_body_markforums_after --> <!-- INCLUDE forumlist_body.html --> diff --git a/phpBB/styles/subsilver2/template/mcp_ban.html b/phpBB/styles/subsilver2/template/mcp_ban.html index edf81c6d76..cc24d21d73 100644 --- a/phpBB/styles/subsilver2/template/mcp_ban.html +++ b/phpBB/styles/subsilver2/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('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]; + if (option in ban_reason) { + document.getElementById('mcp_ban').unbanreason.value = ban_reason[option]; + } else { + document.getElementById('mcp_ban').unbanreason.value = ''; + } + if (option in ban_give_reason) { + document.getElementById('mcp_ban').unbangivereason.value = ban_give_reason[option]; + } else { + document.getElementById('mcp_ban').unbangivereason.value = ''; + } } // ]]> @@ -40,6 +47,7 @@ <tr> <td class="row3" colspan="2">{L_EXPLAIN}</td> </tr> +<!-- EVENT mcp_ban_fields_before --> <tr> <td class="row1" width="45%" valign="top"><b>{L_BAN_CELL}{L_COLON}</b></td> <td class="row2"> @@ -63,6 +71,7 @@ <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> +<!-- EVENT mcp_ban_fields_after --> <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> @@ -78,6 +87,7 @@ <td class="row3" colspan="2">{L_UNBAN_EXPLAIN}</td> </tr> <!-- IF S_BANNED_OPTIONS --> + <!-- EVENT mcp_ban_unban_before --> <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> @@ -94,6 +104,7 @@ <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> + <!-- EVENT mcp_ban_unban_after --> <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> diff --git a/phpBB/styles/subsilver2/template/memberlist_search.html b/phpBB/styles/subsilver2/template/memberlist_search.html index aa6b61fe22..12dd10be2e 100644 --- a/phpBB/styles/subsilver2/template/memberlist_search.html +++ b/phpBB/styles/subsilver2/template/memberlist_search.html @@ -104,8 +104,12 @@ <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"><b class="genmed">{L_JABBER}{L_COLON}</b></td> - <td class="row2"><input class="post" type="text" name="jabber" value="{JABBER}" /></td> + <!-- IF S_JABBER_ENABLED --> + <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> + <!-- ELSE --> + <td colspan="2" class="row1"> </td> + <!-- ENDIF --> </tr> <tr> <td class="row1"><b class="genmed">{L_SORT_BY}{L_COLON}</b></td> diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index 550643ff03..00c627f62e 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -121,10 +121,12 @@ <td><a href="{U_PM}" class="imageset">{PM_IMG}</a></td> </tr> <!-- ENDIF --> + <!-- IF S_JABBER_ENABLED --> <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> + <!-- ENDIF --> <!-- BEGIN custom_fields --> <!-- IF custom_fields.S_PROFILE_CONTACT --> <tr> diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 314e284155..ebb7b3be4d 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -135,6 +135,8 @@ function marklist(id, name, state) {$STYLESHEETS} +<!-- EVENT overall_header_stylesheets_after --> + </head> <body class="{S_CONTENT_DIRECTION} {BODY_CLASS}"> @@ -156,17 +158,20 @@ function marklist(id, name, state) <div id="menubar"> <table width="100%" cellspacing="0"> <tr> - <td class="genmed"> + <td class="genmed dropdown-container"> <!-- 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"> + <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger"> + <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 dropdown"> <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"> + <table class="tablebg" cellspacing="1"> <!-- BEGIN notifications --> <tr class="row<!-- IF notifications.UNREAD -->2<!-- ELSE -->1<!-- ENDIF -->"> <td width="50"> @@ -177,7 +182,11 @@ function marklist(id, name, state) <!-- 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 notifications.REFERENCE --><br /><span class="notification-reference">{notifications.REFERENCE}</span><!-- ENDIF --> + <!-- IF notifications.FORUM --><br /><span class="notification-forum">{notifications.FORUM}</span><!-- ENDIF --> + <!-- IF notifications.REASON --><br /><span class="notification-reason">{notifications.REASON}</span><!-- ENDIF --> + <br /><span class="notification-time">{notifications.TIME}</span> <!-- IF not notifications.URL and notifications.UNREAD --> <br /><a href="{notifications.U_MARK_READ}">{L_MARK_READ}</a> <!-- ENDIF --> @@ -205,7 +214,7 @@ function marklist(id, name, state) </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> + <a href="{U_FAQ}" rel="help"><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 --> @@ -244,7 +253,9 @@ function marklist(id, name, state) <br style="clear: both;" /> <!-- DEFINE $S_MICRODATA = 1 --> + <!-- DEFINE $OVERALL_HEADER_BREADCRUMBS = 1 --> <!-- INCLUDE breadcrumbs.html --> + <!-- UNDEFINE $OVERALL_HEADER_BREADCRUMBS --> <!-- DEFINE $S_MICRODATA = 0 --> <br /> diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html index faeeaea3d5..0c3dff4a05 100644 --- a/phpBB/styles/subsilver2/template/simple_header.html +++ b/phpBB/styles/subsilver2/template/simple_header.html @@ -14,6 +14,8 @@ {$STYLESHEETS} +<!-- EVENT simple_header_stylesheets_after --> + </head> <body class="{S_CONTENT_DIRECTION} {BODY_CLASS}"> diff --git a/phpBB/styles/subsilver2/template/ucp_groups_manage.html b/phpBB/styles/subsilver2/template/ucp_groups_manage.html index 3099fcb1d8..55c1c20528 100644 --- a/phpBB/styles/subsilver2/template/ucp_groups_manage.html +++ b/phpBB/styles/subsilver2/template/ucp_groups_manage.html @@ -78,7 +78,7 @@ <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> + <option value="">{L_NO_AVATAR}</option> <!-- BEGIN avatar_drivers --> <option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_drivers.L_TITLE}</option> <!-- END avatar_drivers --> diff --git a/phpBB/styles/subsilver2/template/ucp_notifications.html b/phpBB/styles/subsilver2/template/ucp_notifications.html index 64e21ec4a6..b0d2925b68 100644 --- a/phpBB/styles/subsilver2/template/ucp_notifications.html +++ b/phpBB/styles/subsilver2/template/ucp_notifications.html @@ -92,9 +92,11 @@ <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> + {notification_list.FORMATTED_TITLE}<!-- IF notification_list.REFERENCE --> {notification_list.REFERENCE}<!-- ENDIF --> <!-- IF notification_list.URL --></a><!-- ENDIF --><br /> - {notification_list.TIME} + <!-- IF notification_list.FORUM --><span class="notifications_forum">{notification_list.FORUM}</span><br /><!-- ENDIF --> + <!-- IF notification_list.REASON --><span class="notifications_reason">{notification_list.REASON}</span><br /><!-- ENDIF --> + <span class="notifications_time">{notification_list.TIME}</span> </span> </td> <td align="center"> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html index be1e27c5f3..9536b1f8c5 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage.html @@ -104,7 +104,19 @@ </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> + <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};"> + <!-- EVENT ucp_pm_viewmessage_post_buttons_before --> + <!-- 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 --> + <!-- EVENT ucp_pm_viewmessage_post_buttons_after --> + </div> + </td> </tr> <tr> diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html index 93fcfac5b1..1c76e3226d 100644 --- a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html +++ b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html @@ -49,7 +49,7 @@ <!-- 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> + <td class="row2"><select name="user_style">{S_STYLE_OPTIONS}</select></td> </tr> <!-- ENDIF --> <!-- INCLUDE timezone_option.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html index 07b3edb498..fc52c149c6 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html @@ -28,7 +28,7 @@ <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" data-togglable-settings="true"> - <option value="">{L_NO_AVATAR_CATEGORY}</option> + <option value="">{L_NO_AVATAR}</option> <!-- BEGIN avatar_drivers --> <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 --> diff --git a/phpBB/styles/subsilver2/template/ucp_profile_profile_info.html b/phpBB/styles/subsilver2/template/ucp_profile_profile_info.html index bf0aa8f899..2d0140a15d 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_profile_info.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_profile_info.html @@ -12,10 +12,12 @@ <tr> <td class="row1" colspan="2"><span class="gensmall">{L_PROFILE_INFO_NOTICE}</span></td> </tr> +<!-- IF S_JABBER_ENABLED --> <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> +<!-- ENDIF --> <!-- 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> diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index 1d55b952e5..162fa2a020 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -34,6 +34,7 @@ </tr> <!-- ENDIF --> +<!-- EVENT ucp_register_credentials_before --> <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> @@ -50,6 +51,8 @@ <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> +<!-- EVENT ucp_register_credentials_after --> +<!-- EVENT ucp_register_options_before --> <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> @@ -57,6 +60,7 @@ <!-- INCLUDE timezone_option.html --> +<!-- EVENT ucp_register_profile_fields_before --> <!-- IF .profile_fields --> <tr> <td class="row2" colspan="2"><span class="gensmall">{L_ITEMS_REQUIRED}</span></td> @@ -73,7 +77,7 @@ <!-- END profile_fields --> <!-- ENDIF --> - +<!-- EVENT ucp_register_profile_fields_after --> <!-- IF CAPTCHA_TEMPLATE --> <!-- INCLUDE {CAPTCHA_TEMPLATE} --> <!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css index e69eec4f14..3c7ff23db5 100644 --- a/phpBB/styles/subsilver2/theme/stylesheet.css +++ b/phpBB/styles/subsilver2/theme/stylesheet.css @@ -632,7 +632,7 @@ input:focus, select:focus, textarea:focus { } .postimage { - max-width: 99%; + max-width: 100%; } .syntaxbg { @@ -1189,12 +1189,21 @@ a.imageset { overflow-x: hidden; } +#notification_list table { + width: 100%; +} + #notification_list .notification_title { - padding: 5px; + padding: 3px; +} + +#notification_list .notification_title:after { + clear: both; + content: ''; + display: block; } #notification_list .header { - width: 298px; padding: 5px; font-weight: bold; border: 1px solid #A9B8C2; @@ -1208,7 +1217,6 @@ a.imageset { } #notification_list .footer { - width: 300px; text-align: center; font-size: 1.2em; border: 1px solid #A9B8C2; @@ -1223,3 +1231,12 @@ a.imageset { #notification_list .footer > a { display: block; } + +#notification_list .notification-time { + font-size: 0.9em; + float: right; +} + +.notification_list .notifications_time { + font-size: 0.8em; +} diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 4c7723b0ac..182bc2e285 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -357,23 +357,3 @@ $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()); - -/** -* 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); - } -} diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index c9623293c6..9086feb390 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -469,11 +469,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 . ' diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 43b5f7f001..a03a81a15e 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -44,6 +44,7 @@ if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) } $pagination = $phpbb_container->get('pagination'); +$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'); @@ -102,7 +103,7 @@ $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': @@ -213,11 +214,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]) { @@ -298,8 +295,21 @@ while ($row = $db->sql_fetchrow($result)) 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': diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index d13d4b444f..1fdce5a6c3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -523,6 +523,19 @@ 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), @@ -546,7 +559,7 @@ 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]); } } @@ -631,7 +644,7 @@ $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, @@ -1141,6 +1154,7 @@ while ($row = $db->sql_fetchrow($result)) 'username' => $row['username'], 'user_colour' => $row['user_colour'], + 'contact_user' => '', 'warnings' => 0, 'allow_pm' => 0, @@ -1198,6 +1212,7 @@ 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, 'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', @@ -1408,6 +1423,46 @@ $template->assign_vars(array( '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) @@ -1699,6 +1754,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POSTER_AVATAR' => $user_cache[$poster_id]['avatar'], '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'], @@ -1773,6 +1829,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @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 @@ -1782,12 +1839,14 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @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', 'total_posts', + 'poster_id', 'row', 'cp_row', 'attachments', diff --git a/tests/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md index d638c86859..afd7caa709 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"; 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/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_oauth_token_storage_test.php b/tests/auth/provider_oauth_token_storage_test.php index ec28e546bd..45daa9816b 100644 --- a/tests/auth/provider_oauth_token_storage_test.php +++ b/tests/auth/provider_oauth_token_storage_test.php @@ -13,6 +13,8 @@ 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; @@ -73,6 +75,22 @@ 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); diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 246397ad6c..d8099b40d4 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -38,10 +38,19 @@ class phpbb_avatar_manager_test extends \phpbb_test_case new phpbb_mock_request() ), new \phpbb\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); + // $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->expects($this->any()) @@ -56,7 +65,14 @@ class phpbb_avatar_manager_test extends \phpbb_test_case 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($config, $phpbb_root_path, $phpEx, $path_helper, $cache)); + } + else + { + $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $path_helper, $guesser, $cache)); + } $cur_avatar->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.' . $driver)); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index bb4a703cc3..2856ba02bb 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -31,4 +31,5 @@ require_once 'test_framework/phpbb_test_case_helpers.php'; 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_mink_test_case.php'; require_once 'test_framework/phpbb_functional_test_case.php'; diff --git a/tests/config_php_file_test.php b/tests/config_php_file_test.php new file mode 100644 index 0000000000..c2e4eb21c7 --- /dev/null +++ b/tests/config_php_file_test.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_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->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->assertSame(array('bar' => 'foo', 'bar_bar' => 'foo foo'), $config_php->get_all()); + } +} diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php index 46705a585f..1059a3f221 100644 --- a/tests/console/cron/cron_list_test.php +++ b/tests/console/cron/cron_list_test.php @@ -75,7 +75,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case public function get_command_tester() { $application = new Application(); - $application->add(new cron_list($this->cron_manager, $this->user)); + $application->add(new cron_list($this->user, $this->cron_manager)); $command = $application->find('cron:list'); $this->command_name = $command->getName(); @@ -98,6 +98,6 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case $this->get_cron_manager($tasks); $this->command_tester = $this->get_command_tester(); - $this->command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true)); + $this->command_tester->execute(array('command' => $this->command_name), array('decorated' => false)); } } diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index ff251cff3c..60bd74e1f0 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -148,7 +148,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case public function get_command_tester() { $application = new Application(); - $application->add(new run($this->cron_manager, $this->lock, $this->user)); + $application->add(new run($this->user, $this->cron_manager, $this->lock)); $command = $application->find('cron:run'); $this->command_name = $command->getName(); diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php index e2b1477e10..aa705c52a5 100644 --- a/tests/content_visibility/delete_post_test.php +++ b/tests/content_visibility/delete_post_test.php @@ -266,7 +266,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case */ public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum) { - 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'; $cache = new phpbb_mock_cache; @@ -284,6 +284,8 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case ))); $user = $this->getMock('\phpbb\user'); + $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, $phpbb_config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index 621efaa830..206c3a4f0b 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -26,6 +26,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index f3c6888c8d..6cc2f8ec0f 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -46,6 +46,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'), @@ -111,6 +112,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' => '', @@ -144,6 +146,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)), 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/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/order_lower_test.php b/tests/dbal/order_lower_test.php index b7a69c7c5d..b101d28c7d 100644 --- a/tests/dbal/order_lower_test.php +++ b/tests/dbal/order_lower_test.php @@ -22,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'); } diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php index 7cac4d6a3b..e480716a49 100644 --- a/tests/dbal/select_test.php +++ b/tests/dbal/select_test.php @@ -219,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 diff --git a/tests/dbal/sql_insert_buffer_test.php b/tests/dbal/sql_insert_buffer_test.php index 2f9ed0008f..eae0abceba 100644 --- a/tests/dbal/sql_insert_buffer_test.php +++ b/tests/dbal/sql_insert_buffer_test.php @@ -32,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()); @@ -50,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))); @@ -68,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); } @@ -93,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/di/create_container_test.php b/tests/di/create_container_test.php index 8bf9f636fa..559c0b122c 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -14,47 +14,135 @@ namespace { require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; - require_once dirname(__FILE__) . '/../../phpBB/includes/functions_container.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->config_php, $this->phpbb_root_path . 'fixtures/', '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->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_dump_container() { - $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->set_dump_container(false); + $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_use_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->set_use_extensions(false); + $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_compile_container() + { + $this->builder->set_compile_container(false); + $container = $this->builder->get_container(); $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); - $this->assertTrue($container->isFrozen()); + + // Checks compile_container + $this->assertFalse($container->isFrozen()); + } + + public function test_inject_config() + { + $this->builder->set_inject_config(false); + $container = $this->builder->get_container(); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + + // Checks inject_config + $this->assertFalse($container->hasParameter('dbal.dbhost')); + } + + public function test_set_config_path() + { + $this->builder->set_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 test_set_custom_parameters() + { + $this->builder->set_custom_parameters(array('my_parameter' => true)); + $container = $this->builder->get_container(); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + + $this->assertTrue($container->hasParameter('my_parameter')); + $this->assertFalse($container->hasParameter('core.root_path')); } } } @@ -102,5 +190,12 @@ namespace phpbb\db\driver function sql_like_expression($expression) { } + + function sql_fetchrowset($query_id = false) + { + return array( + array('ext_name' => 'vendor/enabled'), + ); + } } } diff --git a/tests/di/fixtures/config/services.yml b/tests/di/fixtures/config/services.yml new file mode 100644 index 0000000000..f2a22ae109 --- /dev/null +++ b/tests/di/fixtures/config/services.yml @@ -0,0 +1,14 @@ +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 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/services.yml b/tests/di/fixtures/ext/vendor/disabled/config/services.yml new file mode 100644 index 0000000000..31ada384bf --- /dev/null +++ b/tests/di/fixtures/ext/vendor/disabled/config/services.yml @@ -0,0 +1,2 @@ +parameters: + disabled: true diff --git a/tests/di/fixtures/ext/vendor/enabled/config/services.yml b/tests/di/fixtures/ext/vendor/enabled/config/services.yml new file mode 100644 index 0000000000..88a7919ed1 --- /dev/null +++ b/tests/di/fixtures/ext/vendor/enabled/config/services.yml @@ -0,0 +1,2 @@ +parameters: + enabled: true diff --git a/tests/di/fixtures/other_config/services.yml b/tests/di/fixtures/other_config/services.yml new file mode 100644 index 0000000000..c299bfc648 --- /dev/null +++ b/tests/di/fixtures/other_config/services.yml @@ -0,0 +1,14 @@ +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 diff --git a/tests/event/php_exporter_test.php b/tests/event/php_exporter_test.php index 823d90b63f..b52d68e305 100644 --- a/tests/event/php_exporter_test.php +++ b/tests/event/php_exporter_test.php @@ -118,6 +118,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case 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'), ); } @@ -137,6 +138,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case 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'), ); } diff --git a/tests/extension/ext/barfoo/composer.json b/tests/extension/ext/barfoo/composer.json index d88fd413c9..05bb099707 100644 --- a/tests/extension/ext/barfoo/composer.json +++ b/tests/extension/ext/barfoo/composer.json @@ -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 b8fc544c01..d49aab47cd 100644 --- a/tests/extension/ext/vendor/moo/composer.json +++ b/tests/extension/ext/vendor/moo/composer.json @@ -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/composer.json b/tests/extension/ext/vendor2/bar/composer.json index 215e7d59db..9d2ed86a0c 100644 --- a/tests/extension/ext/vendor2/bar/composer.json +++ b/tests/extension/ext/vendor2/bar/composer.json @@ -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/foo/composer.json b/tests/extension/ext/vendor2/foo/composer.json index 7b2a80f5d3..efcdfc338f 100644 --- a/tests/extension/ext/vendor2/foo/composer.json +++ b/tests/extension/ext/vendor2/foo/composer.json @@ -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/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/manager_test.php b/tests/extension/manager_test.php index d9f8fbd1a4..1e43c2a0a3 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -13,6 +13,7 @@ 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 @@ -32,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'), 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; @@ -60,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; @@ -95,7 +148,7 @@ 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); $phpbb_root_path = __DIR__ . './../../phpBB/'; diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 3678ac0a3f..535e4fe0d5 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -19,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; @@ -50,6 +53,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), $this->phpbb_root_path, $this->phpEx ), @@ -70,7 +74,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case 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, @@ -96,9 +100,10 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { $manager->get_metadata(); } - catch(\phpbb\extension\exception $e){} - - $this->assertEquals((string) $e, $this->user->lang('FILE_NOT_FOUND', $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json')); + catch (\phpbb\extension\exception $e) + { + $this->assertEquals((string) $e, $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 @@ -112,7 +117,7 @@ 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); } @@ -122,64 +127,42 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $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, $this->user->lang('META_FIELD_NOT_SET', 'name')); - } - - try - { - $manager->validate('type'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'type')); - } - - try - { - $manager->validate('license'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'license')); - } + 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) { - $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'version')); + $this->assertEquals((string) $e, $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, $this->user->lang('META_FIELD_NOT_SET', 'authors')); } @@ -193,72 +176,44 @@ 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, $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', - 'license' => '', - 'version' => '', + $field_name => $field_value, )); try { - $manager->validate('name'); - + $manager->validate($field_name); $this->fail('Exception not triggered'); } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'name')); - } - - try - { - $manager->validate('type'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'type')); - } - - try - { - $manager->validate('license'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'license')); - } - - try - { - $manager->validate('version'); - - $this->fail('Exception not triggered'); - } - catch(\phpbb\extension\exception $e) - { - $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'version')); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', $field_name)); } } @@ -286,143 +241,83 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } } - - 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/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index 1aef0d8a0c..c585b17155 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -32,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/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/download_test.php b/tests/functional/download_test.php index dbf197fcfa..6a6df14c81 100644 --- a/tests/functional/download_test.php +++ b/tests/functional/download_test.php @@ -205,12 +205,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'); diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index b6dd5db708..6490c1ead3 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -84,7 +84,7 @@ 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(5, $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()); @@ -162,6 +162,10 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case $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('#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() diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index a474ecf27f..7aa2d0da7d 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -619,12 +619,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case ), )); - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1 - Topic #2']}&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']['Feeds #1 - Topic #2'], 'DELETE_TOPIC'); $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); $this->add_lang('mcp'); diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php index cf36a0523f..29036c821e 100644 --- a/tests/functional/fileupload_form_test.php +++ b/tests/functional/fileupload_form_test.php @@ -42,6 +42,8 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case unlink($fileinfo->getPathname()); } + + parent::tearDown(); } private function upload_file($filename, $mimetype) @@ -107,9 +109,9 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case $crawler = $this->upload_file('disallowed.jpg', 'image/jpeg'); - // Hitting the UNABLE_GET_IMAGE_SIZE error means we passed the + // Hitting the ATTACHED_IMAGE_NOT_IMAGE error means we passed the // DISALLOWED_CONTENT check - $this->assertEquals($this->lang('UNABLE_GET_IMAGE_SIZE'), $crawler->filter('p.error')->text()); + $this->assertContains($this->lang('ATTACHED_IMAGE_NOT_IMAGE'), $crawler->text()); } public function test_too_large() diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index f904258a5c..ef39e1d71b 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -11,6 +11,8 @@ * */ +require_once __DIR__ . '/../../phpBB/includes/functions_upload.php'; + /** * @group functional */ @@ -43,6 +45,8 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case global $config, $user; $user = null; $config = array(); + + parent::tearDown(); } public function test_invalid_extension() diff --git a/tests/functional/fixtures/ext/foo/bar/composer.json b/tests/functional/fixtures/ext/foo/bar/composer.json index 2f91426d2a..f0c7f0e6c1 100644 --- a/tests/functional/fixtures/ext/foo/bar/composer.json +++ b/tests/functional/fixtures/ext/foo/bar/composer.json @@ -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/forgot_password_test.php b/tests/functional/forgot_password_test.php index 64fa19557f..c95efc5b2e 100644 --- a/tests/functional/forgot_password_test.php +++ b/tests/functional/forgot_password_test.php @@ -57,5 +57,7 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case 'config[allow_password_reset]' => 1, )); $crawler = self::submit($form); + + parent::tearDown(); } } diff --git a/tests/functional/jumpbox_test.php b/tests/functional/jumpbox_test.php index 9eddcb6bf6..f5a671b1b9 100644 --- a/tests/functional/jumpbox_test.php +++ b/tests/functional/jumpbox_test.php @@ -20,18 +20,16 @@ class phpbb_functional_jumpbox_test extends phpbb_functional_test_case { $this->login(); - $crawler = self::request('GET', "viewtopic.php?t=1&sid={$this->sid}"); - $form = $crawler->filter('#quickmodform')->selectButton($this->lang('GO'))->form(array( - 'action' => 'merge_topic', - )); + $this->crawler = $this->get_quickmod_page(1, 'MERGE_TOPIC'); + $this->check_valid_jump('Your first forum'); - $crawler = self::submit($form); - $this->assertContains($this->lang('FORUM') . ': Your first forum', $crawler->filter('#cp-main h2')->text()); - $form = $crawler->filter('#jumpbox')->selectButton($this->lang('GO'))->form(array( - 'f' => 1, - )); + $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'); + } - $crawler = self::submit($form); - $this->assertContains($this->lang('FORUM') . ': Your first category', $crawler->filter('#cp-main h2')->text()); + 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/mcp_test.php b/tests/functional/mcp_test.php index e4d950ef34..40615d66a5 100644 --- a/tests/functional/mcp_test.php +++ b/tests/functional/mcp_test.php @@ -35,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); } /** @@ -68,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/plupload_test.php b/tests/functional/plupload_test.php index ee71597ffc..d9faec035c 100644 --- a/tests/functional/plupload_test.php +++ b/tests/functional/plupload_test.php @@ -57,6 +57,8 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case unlink($fileinfo->getPathname()); } + + parent::tearDown(); } public function get_urls() diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 2611ef7bf1..fd802eed45 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -36,4 +36,27 @@ 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 characters', + "This is a test with these weird characters: \xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6", + array(), + 'Your message contains the following unsupported characters' + ); + + 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' + ); + } } diff --git a/tests/functional/private_messages_test.php b/tests/functional/private_messages_test.php new file mode 100644 index 0000000000..1f6dc3a979 --- /dev/null +++ b/tests/functional/private_messages_test.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. +* +*/ + +/** +* @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()); + } +} diff --git a/tests/functional/ucp_profile_test.php b/tests/functional/ucp_profile_test.php index ea08eece78..e7abba9255 100644 --- a/tests/functional/ucp_profile_test.php +++ b/tests/functional/ucp_profile_test.php @@ -25,13 +25,25 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case $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/visibility_softdelete_test.php b/tests/functional/visibility_softdelete_test.php index 5b5f09905c..794f0cde68 100644 --- a/tests/functional/visibility_softdelete_test.php +++ b/tests/functional/visibility_softdelete_test.php @@ -186,11 +186,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ '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); + $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'); @@ -261,12 +257,8 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ '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); + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'DELETE_TOPIC'); $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); $this->add_lang('mcp'); @@ -336,11 +328,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ '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); + $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'); @@ -484,12 +472,9 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ '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}"); + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'SPLIT_TOPIC'); $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( @@ -546,12 +531,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ ), )); - $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); - + $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); @@ -605,9 +585,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ $this->assertContainsLang('BOOKMARK_ADDED', $crawler_bookmark->text()); $this->add_lang('mcp'); - $form = $crawler->selectButton('Go')->eq(1)->form(); - $form['action']->select('merge_topic'); - $crawler = self::submit($form); + $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']}"); @@ -670,12 +648,8 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ '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); + $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(); diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index 7a70bddc71..06415a424e 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -30,10 +30,11 @@ class phpbb_build_url_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), $phpbb_root_path, 'php' ); - $phpbb_container->set('path_helper', $path_helper); + $phpbb_container->set('path_helper', $phpbb_path_helper); } public function build_url_test_data() { diff --git a/tests/functions/convert_30_dbms_to_31_test.php b/tests/functions/convert_30_dbms_to_31_test.php index 9647eb341c..729c0a82f0 100644 --- a/tests/functions/convert_30_dbms_to_31_test.php +++ b/tests/functions/convert_30_dbms_to_31_test.php @@ -18,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'), @@ -37,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/obtain_online_test.php b/tests/functions/obtain_online_test.php index 830b52fb4c..e793a4eb82 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -128,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_content/get_username_string_test.php b/tests/functions_content/get_username_string_test.php index 502796d1df..01ec97f6a4 100644 --- a/tests/functions_content/get_username_string_test.php +++ b/tests/functions_content/get_username_string_test.php @@ -94,11 +94,11 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case global $phpbb_root_path, $phpEx; return array( - array(0, '', '', false, false, 'Guest'), - array(ANONYMOUS, 'Anonymous', '', false, false, 'Anonymous'), + 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">User5</a>'), - array(8, 'Eight', '', false, false, '<a href="' . $phpbb_root_path . 'memberlist.php?mode=viewprofile&u=8">Eight</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>'), ); } @@ -113,10 +113,10 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case public function get_username_string_no_profile_data() { return array( - array(ANONYMOUS, 'Anonymous', '', false, false, 'Anonymous'), - array(ANONYMOUS, 'Anonymous', '', '', false, 'Guest'), + 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, 'Eight'), + array(8, 'Eight', '', false, false, '<span class="username">Eight</span>'), ); } diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index b7e60c7393..02e0b3912f 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -40,7 +40,7 @@ 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, @@ -59,7 +59,7 @@ 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, @@ -78,7 +78,7 @@ 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, @@ -97,7 +97,7 @@ 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, @@ -118,7 +118,7 @@ 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, @@ -139,7 +139,7 @@ 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, @@ -160,7 +160,7 @@ 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, @@ -177,11 +177,11 @@ 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, @@ -196,11 +196,11 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case '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' => 'Anonymous', + 'username_full' => '<span class="username">Anonymous</span>', 'ip' => '127.0.0.1', 'time' => 1, @@ -219,7 +219,7 @@ 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, @@ -238,7 +238,7 @@ 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, diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php index 9f70f8e96c..f9d231258e 100644 --- a/tests/mock/controller_helper.php +++ b/tests/mock/controller_helper.php @@ -23,4 +23,9 @@ class phpbb_mock_controller_helper extends \phpbb\controller\helper $provider->find_routing_files($manager->get_finder()); $this->route_collection = $provider->find($phpbb_root_path_ext)->get_routes(); } + + public function get_current_url() + { + return ''; + } } 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/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php index 7e0add2bb5..851c9ec221 100644 --- a/tests/notification/user_list_trim_test.php +++ b/tests/notification/user_list_trim_test.php @@ -75,7 +75,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case 'post_username' => 'A', 'responders' => null, ), - 'A replied to the topic “Test”.', + '<strong>Reply</strong> from A in topic:', ), array( array( @@ -86,7 +86,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case array('username' => '', 'poster_id' => 3), ), ), - 'A and B replied to the topic “Test”.', + '<strong>Reply</strong> from A and <span class="username">B</span> in topic:', ), array( array( @@ -98,7 +98,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case array('username' => '', 'poster_id' => 4), ), ), - 'A, B, and C replied to the topic “Test”.', + '<strong>Reply</strong> from A, <span class="username">B</span>, and <span class="username">C</span> in topic:', ), array( array( @@ -111,7 +111,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case array('username' => '', 'poster_id' => 5), ), ), - 'A, B, C, and D replied to the topic “Test”.', + '<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( @@ -125,7 +125,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case array('username' => '', 'poster_id' => 6), ), ), - 'A, B, C, and 2 others replied to the topic “Test”.', + '<strong>Reply</strong> from A, <span class="username">B</span>, <span class="username">C</span>, and 2 others in topic:', ), ); } diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index a3ad901379..27e94d6a07 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -13,6 +13,7 @@ class phpbb_path_helper_test extends phpbb_test_case { + /** @var \phpbb\path_helper */ protected $path_helper; protected $phpbb_root_path = ''; @@ -20,13 +21,15 @@ class phpbb_path_helper_test extends phpbb_test_case { parent::setUp(); - $this->set_phpbb_root_path(); + $filesystem = new \phpbb\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(), + $this->getMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); @@ -40,9 +43,9 @@ class phpbb_path_helper_test extends phpbb_test_case * 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() + public function set_phpbb_root_path($filesystem) { - $this->phpbb_root_path = dirname(__FILE__) . './../../phpBB/'; + $this->phpbb_root_path = $filesystem->clean_path(dirname(__FILE__) . '/../../phpBB/'); } public function test_get_web_root_path() @@ -53,7 +56,8 @@ class phpbb_path_helper_test extends phpbb_test_case public function basic_update_web_root_path_data() { - $this->set_phpbb_root_path(); + $filesystem = new \phpbb\filesystem(); + $this->set_phpbb_root_path($filesystem); return array( array( @@ -71,7 +75,7 @@ class phpbb_path_helper_test extends phpbb_test_case ), array( $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', + $filesystem->clean_path($this->phpbb_root_path . $this->phpbb_root_path . 'test.php'), ), ); } @@ -81,51 +85,55 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function test_basic_update_web_root_path($input, $expected) { - $this->assertEquals($expected, $this->path_helper->update_web_root_path($input, $symfony_request)); + $this->assertEquals($expected, $this->path_helper->update_web_root_path($input)); } public function update_web_root_path_data() { - $this->set_phpbb_root_path(); + $this->set_phpbb_root_path(new \phpbb\filesystem()); return array( array( $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . 'test.php', '/', + null, + null, + '', ), array( $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../test.php', '//', + null, + null, + './../', ), 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', + './../', ), array( $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../test.php', '/', '/phpbb3-fork/phpBB/app.php/', '/phpbb3-fork/phpBB/app.php', + './../', ), ); } @@ -133,9 +141,9 @@ class phpbb_path_helper_test extends phpbb_test_case /** * @dataProvider update_web_root_path_data */ - public function test_update_web_root_path($input, $expected, $getPathInfo, $getRequestUri = null, $getScriptName = null) + public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction) { - $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array( + $symfony_request = $this->getMock('\phpbb\symfony_request', array(), array( new phpbb_mock_request(), )); $symfony_request->expects($this->any()) @@ -151,11 +159,12 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); - $this->assertEquals($expected, $path_helper->update_web_root_path($input, $symfony_request)); + $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input, $symfony_request)); } public function clean_url_data() @@ -331,4 +340,58 @@ class phpbb_path_helper_test extends phpbb_test_case { $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/', + ), + ); + } + + /** + * @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)); + } } diff --git a/tests/profile/custom_string_test.php b/tests/profile/custom_string_test.php deleted file mode 100644 index 9e45d05ae3..0000000000 --- a/tests/profile/custom_string_test.php +++ /dev/null @@ -1,120 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.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/utf/utf_tools.php'; - -class phpbb_profile_custom_string_test extends phpbb_database_test_case -{ - public function getDataSet() - { - return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/profile_fields.xml'); - } - - static public function string_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, validation, expected, description - array( - 1, - 'H3110', - '[0-9]+', - 'FIELD_INVALID_CHARS_NUMBERS_ONLY-field', - 'Required field should reject characters in a numbers-only field', - ), - array( - 1, - 'This string is too long', - '.*', - 'FIELD_TOO_LONG-10-field', - 'Required field should reject a field too long', - ), - array( - 0, - '<>"&%&><>', - '.*', - false, - 'Optional field should accept html entities', - ), - array( - 1, - 'ö ä ü ß', - '.*', - false, - 'Required field should accept UTF-8 string', - ), - array( - 1, - 'This ö ä string has to b', - '.*', - 'FIELD_TOO_LONG-10-field', - 'Required field should reject an UTF-8 string which is too long', - ), - array( - 1, - 'ö äö äö ä', - '[\w]+', - 'FIELD_INVALID_CHARS_ALPHA_ONLY-field', - 'Required field should reject UTF-8 in alpha only field', - ), - array( - 1, - 'Hello', - '[\w]+', - false, - 'Required field should accept a characters only field', - ), - ); - } - - /** - * @dataProvider string_fields - */ - public function test_string_validate($field_required, $field_value, $field_validation, $expected, $description) - { - $db = $this->new_dbal(); - - $field_data = array( - 'field_id' => 1, - 'lang_id' => 1, - 'lang_name' => 'field', - 'field_novalue' => 1, - 'field_required' => $field_required, - 'field_maxlen' => 10, - 'field_validation' => $field_validation, - ); - $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_string( - $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/custom_test.php b/tests/profile/custom_test.php deleted file mode 100644 index 8570e8e6ee..0000000000 --- a/tests/profile/custom_test.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.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_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 7a4a4ab5c2..0000000000 --- a/tests/profile/get_profile_value_test.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.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_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..bdab179c8c --- /dev/null +++ b/tests/profilefields/type_bool_test.php @@ -0,0 +1,195 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.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() + { + $user = $this->getMock('\phpbb\user'); + $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..0ad2cde9fe --- /dev/null +++ b/tests/profilefields/type_date_test.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. +* +*/ + +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() + { + $this->user = $this->getMock('\phpbb\user'); + $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..ebecbf97f0 --- /dev/null +++ b/tests/profilefields/type_dropdown_test.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. +* +*/ + +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() + { + $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'); + + $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..fdbdd86553 --- /dev/null +++ b/tests/profilefields/type_googleplus_test.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. +* +*/ + +class phpbb_profilefield_type_googleplus_test extends phpbb_test_case +{ + 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) + { + $user = $this->getMock('\phpbb\user'); + $request = $this->getMock('\phpbb\request\request'); + $template = $this->getMock('\phpbb\template\template'); + + $field = new \phpbb\profilefields\type\type_googleplus( + $request, + $template, + $user + ); + + $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, $field->get_profile_contact_value($value, $field_options), $description); + } +} diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php new file mode 100644 index 0000000000..ac48c10a84 --- /dev/null +++ b/tests/profilefields/type_int_test.php @@ -0,0 +1,236 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.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() + { + $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'); + + $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..2277526758 --- /dev/null +++ b/tests/profilefields/type_string_test.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. +* +*/ + +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; + + $user = $this->getMock('\phpbb\user'); + $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' => '[\w]+'), + 'FIELD_INVALID_CHARS_ALPHA_ONLY-field', + 'Required field should reject UTF-8 in alpha only field', + ), + array( + 'Hello', + array('field_validation' => '[\w]+'), + false, + 'Required field should accept a characters only field', + ), + array( + 'Valid.Username123', + array('field_validation' => '[\w.]+'), + false, + 'Required field should accept a alphanumeric field with dots', + ), + array( + 'Invalid.,username123', + array('field_validation' => '[\w.]+'), + 'FIELD_INVALID_CHARS_ALPHA_DOTS-field', + 'Required field should reject field with comma', + ), + 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', + ), + ); + } + + /** + * @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..a45a28e7c7 --- /dev/null +++ b/tests/profilefields/type_url_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'; + +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() + { + $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'); + + $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', + ), + ); + } + + /** + * @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', + ), + ); + } + + /** + * @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/security/redirect_test.php b/tests/security/redirect_test.php index fb1011cde0..3961c2781e 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -63,6 +63,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index ce3c90b78a..c415c969fe 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -143,6 +143,7 @@ Zeta test event in all', new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 4f5b7629d5..0bbfe3848d 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -352,6 +352,13 @@ 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', + ), ); } diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 00b823b2c4..83446b5352 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -72,6 +72,7 @@ class phpbb_template_template_test_case extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 4f778a9c1c..68ecc4b706 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -27,6 +27,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat new phpbb_mock_request() ), new \phpbb\filesystem(), + $this->getMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); 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/test_framework/phpbb_database_connection_odbc_pdo_wrapper.php b/tests/test_framework/phpbb_database_connection_odbc_pdo_wrapper.php index 22d55b4ed5..db31edc984 100644 --- a/tests/test_framework/phpbb_database_connection_odbc_pdo_wrapper.php +++ b/tests/test_framework/phpbb_database_connection_odbc_pdo_wrapper.php @@ -25,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 1f3a564205..46276bcfcb 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -145,25 +145,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; } @@ -244,19 +226,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 b73b05025e..92e2080dba 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -116,7 +116,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']; } @@ -130,14 +130,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; @@ -197,7 +189,6 @@ class phpbb_database_test_connection_manager { case 'phpbb\db\driver\sqlite': case 'phpbb\db\driver\sqlite3': - case 'phpbb\db\driver\firebird': $this->connect(); // Drop all of the tables foreach ($this->get_tables() as $table) @@ -298,13 +289,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'; @@ -358,14 +342,17 @@ 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)) + { + $queries = file_get_contents($filename); + $sql = phpbb_remove_comments($queries); - $sql = split_sql_file($sql, $this->dbms['DELIM']); + $sql = split_sql_file($sql, $this->dbms['DELIM']); - foreach ($sql as $query) - { - $this->pdo->exec($query); + foreach ($sql as $query) + { + $this->pdo->exec($query); + } } // Ok we have the db info go ahead and work on building the table @@ -404,11 +391,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' => ';', @@ -478,18 +460,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'; diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index e4504a5f8d..9bb4d69bf4 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -11,14 +11,12 @@ * */ use Symfony\Component\BrowserKit\CookieJar; +use Behat\Mink\Driver\Goutte\Client; +use Behat\Mink\Driver\GoutteDriver; -require_once __DIR__ . '/../../phpBB/includes/functions_install.php'; - -class phpbb_functional_test_case extends phpbb_test_case +class phpbb_functional_test_case extends phpbb_mink_test_case { - static protected $client; static protected $cookieJar; - static protected $root_url; protected $cache = null; protected $db = null; @@ -36,7 +34,6 @@ class phpbb_functional_test_case extends phpbb_test_case */ protected $lang = array(); - static protected $config = array(); static protected $already_installed = false; static public function setUpBeforeClass() @@ -46,6 +43,24 @@ class phpbb_functional_test_case extends phpbb_test_case self::$config = phpbb_test_case_helpers::get_test_config(); self::$root_url = self::$config['phpbb_functional_url']; + self::$cookieJar = new CookieJar; + self::$client = new Client(array(), null, self::$cookieJar); + + $client_options = array( + Guzzle\Http\Client::DISABLE_REDIRECTS => true, + 'curl.options' => array( + CURLOPT_TIMEOUT => 120, + ), + ); + + self::$client->setClient(new Guzzle\Http\Client('', $client_options)); + + // Reset the curl handle because it is 0 at this point and not a valid + // resource + self::$client->getClient()->getCurlMulti()->reset(true); + + self::$driver = new GoutteDriver(self::$client); + // 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 @@ -78,12 +93,6 @@ class phpbb_functional_test_case extends phpbb_test_case $this->bootstrap(); - self::$cookieJar = new CookieJar; - self::$client = new Goutte\Client(array(), null, self::$cookieJar); - // Reset the curl handle because it is 0 at this point and not a valid - // resource - self::$client->getClient()->getCurlMulti()->reset(true); - // Clear the language array so that things // that were added in other tests are gone $this->lang = array(); @@ -110,13 +119,14 @@ class phpbb_functional_test_case extends phpbb_test_case 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(); } + + self::$cookieJar->clear(); + parent::tearDown(); } /** @@ -256,144 +266,6 @@ class phpbb_functional_test_case extends phpbb_test_case return $extension_manager; } - static protected 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); - } - } - - 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); - - $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(); - - // install/index.php?mode=install&sub=requirements - $crawler = self::submit($form); - self::assertContains('Installation compatibility', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // 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'], - )); - - // install/index.php?mode=install&sub=database - $crawler = self::submit($form); - self::assertContains('Successful connection', $crawler->filter('#main')->text()); - $form = $crawler->selectButton('submit')->form(); - - // 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', - )); - - // install/index.php?mode=install&sub=administrator - $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, false, true); - $config_created = file_put_contents($config_file, $config_php_data) !== false; - if (!$config_created) - { - self::markTestSkipped("Could not write $config_file file."); - } - - // 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) - { - self::markTestSkipped("Could not create $lock_created file."); - } - @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()); - - copy($config_file, $config_file_test); - } - public function install_ext($extension) { $this->login(); @@ -412,12 +284,6 @@ class phpbb_functional_test_case extends phpbb_test_case $this->logout(); } - static private function recreate_database($config) - { - $db_conn_mgr = new phpbb_database_test_connection_manager($config); - $db_conn_mgr->recreate_db(); - } - /** * Creates a new style * @@ -1031,6 +897,76 @@ class phpbb_functional_test_case extends phpbb_test_case { $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) + { + $crawler = self::request('GET', $posting_url); $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text()); @@ -1072,19 +1008,7 @@ 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); - - if ($expected !== '') - { - $this->assertContainsLang($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'), - ); + return self::request('POST', $posting_url, $form_data); } /** @@ -1097,12 +1021,8 @@ class phpbb_functional_test_case extends phpbb_test_case */ public function delete_topic($topic_id) { - $crawler = self::request('GET', "viewtopic.php?t={$topic_id}&sid={$this->sid}"); - $this->add_lang('posting'); - $form = $crawler->selectButton('Go')->eq(1)->form(); - $form['action']->select('delete_topic'); - $crawler = self::submit($form); + $crawler = $this->get_quickmod_page($topic_id, 'DELETE_TOPIC'); $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text()); $this->add_lang('mcp'); @@ -1193,4 +1113,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_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php new file mode 100644 index 0000000000..ba480e35fb --- /dev/null +++ b/tests/test_framework/phpbb_mink_test_case.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. +* +*/ +use \Behat\Mink\Session; + +require_once __DIR__ . '/../../phpBB/includes/functions_install.php'; + +abstract class phpbb_mink_test_case extends phpbb_test_case +{ + static protected $driver; + static protected $client; + static protected $session; + static protected $config = array(); + static protected $root_url; + + public function __construct($name = null, array $data = array(), $dataName = '') + { + parent::__construct($name, $data, $dataName); + + $this->backupStaticAttributesBlacklist += array( + 'phpbb_mink_test_case' => array('config', 'already_installed'), + ); + } + + static public function setUpBeforeClass() + { + parent::setUpBeforeClass(); + } + + public function setUp() + { + parent::setUp(); + + if (!self::$driver) + { + self::markTestSkipped('Mink driver not initialized.'); + } + + if (!self::$session) + { + self::$session = new Session(self::$driver); + } + } + + static protected function recreate_database($config) + { + $db_conn_mgr = new phpbb_database_test_connection_manager($config); + $db_conn_mgr->recreate_db(); + } + + protected function tearDown() + { + self::$session->reset(); + parent::tearDown(); + } + + static protected function visit($path) + { + self::$session->visit(self::$root_url . $path); + return self::$session->getPage(); + } + + static protected function click_submit($submit_button_id = 'submit') + { + self::$session->getPage()->findById($submit_button_id)->click(); + return self::$session->getPage(); + } + + static protected function install_board() + { + global $phpbb_root_path, $phpEx; + + self::recreate_database(self::$config); + self::$session = new Session(self::$driver); + + $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); + } + } + + $parseURL = parse_url(self::$config['phpbb_functional_url']); + + $page = self::visit('install/index.php?mode=install'); + self::assertContains('Welcome to Installation', $page->findById('main')->getText()); + + // install/index.php?mode=install&sub=requirements + $page = self::click_submit(); + self::assertContains('Installation compatibility', $page->findById('main')->getText()); + + // install/index.php?mode=install&sub=database + $page = self::click_submit(); + self::assertContains('Database configuration', $page->findById('main')->getText()); + + $page->findById('dbms')->setValue(str_replace('phpbb\db\driver\\', '', self::$config['dbms'])); + $page->findById('dbhost')->setValue(self::$config['dbhost']); + $page->findById('dbport')->setValue(self::$config['dbport']); + $page->findById('dbname')->setValue(self::$config['dbname']); + $page->findById('dbuser')->setValue(self::$config['dbuser']); + $page->findById('dbpasswd')->setValue(self::$config['dbpasswd']); + $page->findById('table_prefix')->setValue(self::$config['table_prefix']); + + // install/index.php?mode=install&sub=database + $page = self::click_submit(); + self::assertContains('Successful connection', $page->findById('main')->getText()); + + // install/index.php?mode=install&sub=administrator + $page = self::click_submit(); + self::assertContains('Administrator configuration', $page->findById('main')->getText()); + + $page->findById('admin_name')->setValue('admin'); + $page->findById('admin_pass1')->setValue('adminadmin'); + $page->findById('admin_pass2')->setValue('adminadmin'); + $page->findById('board_email')->setValue('nobody@example.com'); + + // install/index.php?mode=install&sub=administrator + $page = self::click_submit(); + self::assertContains('Tests passed', $page->findById('main')->getText()); + + // install/index.php?mode=install&sub=config_file + $page = self::click_submit(); + + // Installer has created a config.php file, we will overwrite it with a + // config file of our own in order to get the DEBUG constants defined + $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, false, true); + $config_created = file_put_contents($config_file, $config_php_data) !== false; + if (!$config_created) + { + self::markTestSkipped("Could not write $config_file file."); + } + + if (strpos($page->findById('main')->getText(), 'The configuration file has been written') === false) + { + $page = self::click_submit('dldone'); + } + self::assertContains('The configuration file has been written', $page->findById('main')->getText()); + + // install/index.php?mode=install&sub=advanced + $page = self::click_submit(); + self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $page->findById('main')->getText()); + + $page->findById('smtp_delivery')->setValue('1'); + $page->findById('smtp_host')->setValue('nxdomain.phpbb.com'); + $page->findById('smtp_user')->setValue('nxuser'); + $page->findById('smtp_pass')->setValue('nxpass'); + $page->findById('server_protocol')->setValue($parseURL['scheme'] . '://'); + $page->findById('server_name')->setValue('localhost'); + $page->findById('server_port')->setValue(isset($parseURL['port']) ? $parseURL['port'] : 80); + $page->findById('script_path')->setValue($parseURL['path']); + + // install/index.php?mode=install&sub=create_table + $page = self::click_submit(); + self::assertContains('The database tables used by phpBB', $page->findById('main')->getText()); + self::assertContains('have been created and populated with some initial data.', $page->findById('main')->getText()); + + // install/index.php?mode=install&sub=final + $page = self::click_submit(); + self::assertContains('You have successfully installed', $page->getText()); + + copy($config_file, $config_file_test); + + self::$session->stop(); + } +} diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php index 8a5d582573..d4fc174a12 100644 --- a/tests/test_framework/phpbb_session_test_case.php +++ b/tests/test_framework/phpbb_session_test_case.php @@ -32,6 +32,7 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case $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_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index a29b6e1955..dee70ad016 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -142,17 +142,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, @@ -183,13 +181,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'] : '', diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php index 5e333213f4..d8fa82e2b5 100644 --- a/tests/upload/filespec_test.php +++ b/tests/upload/filespec_test.php @@ -65,6 +65,16 @@ 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); } private function get_filespec($override = array()) @@ -78,7 +88,7 @@ class phpbb_filespec_test extends phpbb_test_case 'error' => '', ); - return new filespec(array_merge($upload_ary, $override), null); + return new filespec(array_merge($upload_ary, $override), null, $this->mimetype_guesser); } protected function tearDown() @@ -222,6 +232,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), ); } @@ -234,6 +247,30 @@ 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) + { + $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( diff --git a/tests/viewonline/helper_test.php b/tests/viewonline/helper_test.php new file mode 100644 index 0000000000..bbbed59de7 --- /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()); + } + + 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/travis/check-image-icc-profiles.sh b/travis/check-image-icc-profiles.sh index 31848dc9e7..bb070ccc27 100755 --- a/travis/check-image-icc-profiles.sh +++ b/travis/check-image-icc-profiles.sh @@ -13,7 +13,7 @@ set -e DB=$1 TRAVIS_PHP_VERSION=$2 -if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ] +if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ] then find . -type f -not -path './phpBB/vendor/*' -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' | \ parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}' diff --git a/travis/ext-sniff.sh b/travis/ext-sniff.sh new file mode 100755 index 0000000000..4e557a41c1 --- /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/setup-phpbb.sh b/travis/setup-phpbb.sh index e2cf6eeda2..f065faf8e2 100755 --- a/travis/setup-phpbb.sh +++ b/travis/setup-phpbb.sh @@ -14,7 +14,7 @@ set -x DB=$1 TRAVIS_PHP_VERSION=$2 -if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ] +if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ] then travis/setup-exiftool.sh fi diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh index a9941d4def..ea1929a5b0 100755 --- a/travis/setup-webserver.sh +++ b/travis/setup-webserver.sh @@ -53,6 +53,7 @@ else user = $USER group = $USER listen = $APP_SOCK + listen.mode = 0666 pm = static pm.max_children = 2 |