aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.jscsrc78
-rw-r--r--.jshintrc24
-rw-r--r--.travis.yml1
-rw-r--r--CONTRIBUTING.md6
-rw-r--r--build/build.xml12
-rw-r--r--build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php94
-rw-r--r--build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php143
-rw-r--r--build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php65
-rw-r--r--build/code_sniffer/ruleset-minimum.xml3
-rw-r--r--build/sami-all.conf.php11
-rwxr-xr-xcomposer.pharbin1038928 -> 1075150 bytes
-rw-r--r--phpBB/adm/style/acp_jabber.html2
-rw-r--r--phpBB/adm/style/install_header.html2
-rw-r--r--phpBB/adm/style/install_update_diff.html2
-rw-r--r--phpBB/adm/style/overall_header.html2
-rw-r--r--phpBB/adm/style/simple_header.html1
-rw-r--r--phpBB/assets/javascript/core.js326
-rw-r--r--phpBB/assets/javascript/editor.js5
-rw-r--r--phpBB/assets/javascript/plupload.js314
-rw-r--r--phpBB/composer.json4
-rw-r--r--phpBB/composer.lock56
-rw-r--r--phpBB/develop/export_events_for_wiki.php53
-rw-r--r--phpBB/develop/search_fill.php2
-rw-r--r--phpBB/docs/CHANGELOG.html151
-rw-r--r--phpBB/docs/CREDITS.txt3
-rw-r--r--phpBB/docs/INSTALL.html2
-rw-r--r--phpBB/docs/events.md123
-rw-r--r--phpBB/includes/acp/acp_attachments.php2
-rw-r--r--phpBB/includes/acp/acp_board.php21
-rw-r--r--phpBB/includes/acp/acp_database.php1
-rw-r--r--phpBB/includes/acp/acp_extensions.php5
-rw-r--r--phpBB/includes/acp/acp_jabber.php7
-rw-r--r--phpBB/includes/acp/acp_main.php2
-rw-r--r--phpBB/includes/acp/acp_prune.php4
-rw-r--r--phpBB/includes/acp/acp_search.php3
-rw-r--r--phpBB/includes/bbcode.php34
-rw-r--r--phpBB/includes/constants.php2
-rw-r--r--phpBB/includes/functions.php42
-rw-r--r--phpBB/includes/functions_acp.php20
-rw-r--r--phpBB/includes/functions_admin.php25
-rw-r--r--phpBB/includes/functions_display.php73
-rw-r--r--phpBB/includes/functions_module.php4
-rw-r--r--phpBB/includes/functions_posting.php2
-rw-r--r--phpBB/includes/functions_upload.php2
-rw-r--r--phpBB/includes/functions_user.php35
-rw-r--r--phpBB/includes/mcp/mcp_front.php37
-rw-r--r--phpBB/includes/mcp/mcp_main.php27
-rw-r--r--phpBB/includes/mcp/mcp_post.php47
-rw-r--r--phpBB/includes/mcp/mcp_reports.php59
-rw-r--r--phpBB/includes/message_parser.php48
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php2
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php2
-rw-r--r--phpBB/includes/ucp/ucp_profile.php18
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php2
-rw-r--r--phpBB/install/install_convert.php2
-rw-r--r--phpBB/install/install_install.php12
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/language/en/acp/extensions.php2
-rw-r--r--phpBB/language/en/captcha_recaptcha.php2
-rw-r--r--phpBB/language/en/migrator.php7
-rw-r--r--phpBB/phpbb/auth/provider/base.php2
-rw-r--r--phpBB/phpbb/auth/provider/ldap.php3
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php9
-rw-r--r--phpBB/phpbb/auth/provider/oauth/token_storage.php7
-rw-r--r--phpBB/phpbb/auth/provider/provider_interface.php6
-rw-r--r--phpBB/phpbb/avatar/driver/local.php4
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php4
-rw-r--r--phpBB/phpbb/captcha/plugins/qa.php62
-rw-r--r--phpBB/phpbb/content_visibility.php6
-rw-r--r--phpBB/phpbb/controller/helper.php32
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php37
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php37
-rw-r--r--phpBB/phpbb/db/migration/data/v310/avatars.php24
-rw-r--r--phpBB/phpbb/db/migration/data/v310/style_update_p1.php6
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v314.php32
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v314rc1.php31
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v314rc2.php32
-rw-r--r--phpBB/phpbb/db/sql_insert_buffer.php2
-rw-r--r--phpBB/phpbb/event/md_exporter.php137
-rw-r--r--phpBB/phpbb/event/php_exporter.php120
-rw-r--r--phpBB/phpbb/log/log.php85
-rw-r--r--phpBB/phpbb/notification/method/base.php4
-rw-r--r--phpBB/phpbb/passwords/driver/helper.php16
-rw-r--r--phpBB/phpbb/passwords/manager.php2
-rw-r--r--phpBB/phpbb/permissions.php3
-rw-r--r--phpBB/phpbb/plupload/plupload.php6
-rw-r--r--phpBB/phpbb/search/fulltext_mysql.php55
-rw-r--r--phpBB/phpbb/search/fulltext_native.php130
-rw-r--r--phpBB/phpbb/search/fulltext_postgres.php55
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php6
-rw-r--r--phpBB/phpbb/template/twig/loader.php3
-rw-r--r--phpBB/phpbb/template/twig/node/definenode.php4
-rw-r--r--phpBB/phpbb/template/twig/node/event.php1
-rw-r--r--phpBB/phpbb/template/twig/node/expression/binary/equalequal.php1
-rw-r--r--phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php1
-rw-r--r--phpBB/phpbb/template/twig/node/includenode.php1
-rw-r--r--phpBB/phpbb/template/twig/node/includephp.php7
-rw-r--r--phpBB/phpbb/template/twig/node/php.php1
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/defineparser.php8
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/event.php1
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includejs.php1
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includeparser.php1
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includephp.php4
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/php.php1
-rw-r--r--phpBB/posting.php72
-rw-r--r--phpBB/search.php2
-rw-r--r--phpBB/styles/prosilver/style.cfg4
-rw-r--r--phpBB/styles/prosilver/template/ajax.js45
-rw-r--r--phpBB/styles/prosilver/template/forum_fn.js77
-rw-r--r--phpBB/styles/prosilver/template/forumlist_body.html2
-rw-r--r--phpBB/styles/prosilver/template/index_body.html8
-rw-r--r--phpBB/styles/prosilver/template/login_body.html2
-rw-r--r--phpBB/styles/prosilver/template/login_forum.html2
-rw-r--r--phpBB/styles/prosilver/template/mcp_post.html4
-rw-r--r--phpBB/styles/prosilver/template/memberlist_email.html8
-rw-r--r--phpBB/styles/prosilver/template/navbar_footer.html2
-rw-r--r--phpBB/styles/prosilver/template/overall_footer.html3
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html41
-rw-r--r--phpBB/styles/prosilver/template/posting_editor.html4
-rw-r--r--phpBB/styles/prosilver/template/posting_pm_layout.html2
-rw-r--r--phpBB/styles/prosilver/template/posting_poll_body.html21
-rw-r--r--phpBB/styles/prosilver/template/search_body.html1
-rw-r--r--phpBB/styles/prosilver/template/search_results.html2
-rw-r--r--phpBB/styles/prosilver/template/simple_footer.html2
-rw-r--r--phpBB/styles/prosilver/template/simple_header.html4
-rw-r--r--phpBB/styles/prosilver/template/ucp_login_link.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_profile_reg_details.html8
-rw-r--r--phpBB/styles/prosilver/template/ucp_register.html6
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html8
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html4
-rw-r--r--phpBB/styles/prosilver/theme/bidi.css17
-rw-r--r--phpBB/styles/prosilver/theme/buttons.css3
-rw-r--r--phpBB/styles/prosilver/theme/colours.css8
-rw-r--r--phpBB/styles/prosilver/theme/common.css7
-rw-r--r--phpBB/styles/prosilver/theme/content.css3
-rw-r--r--phpBB/styles/prosilver/theme/forms.css7
-rw-r--r--phpBB/styles/subsilver2/style.cfg4
-rw-r--r--phpBB/styles/subsilver2/template/index_body.html2
-rw-r--r--phpBB/styles/subsilver2/template/login_body.html2
-rw-r--r--phpBB/styles/subsilver2/template/login_forum.html2
-rw-r--r--phpBB/styles/subsilver2/template/mcp_post.html5
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html2
-rw-r--r--phpBB/styles/subsilver2/template/posting_body.html5
-rw-r--r--phpBB/styles/subsilver2/template/posting_poll_body.html1
-rw-r--r--phpBB/styles/subsilver2/template/search_body.html1
-rw-r--r--phpBB/styles/subsilver2/template/ucp_login_link.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_profile_reg_details.html8
-rw-r--r--phpBB/styles/subsilver2/template/ucp_register.html6
-rw-r--r--phpBB/styles/subsilver2/template/viewforum_body.html5
-rw-r--r--phpBB/viewonline.php24
-rw-r--r--phpBB/viewtopic.php77
-rw-r--r--phpBB/web.config12
-rw-r--r--tests/captcha/qa_test.php94
-rw-r--r--tests/controller/common_helper_route.php7
-rw-r--r--tests/controller/helper_route_slash_test.php43
-rw-r--r--tests/event/fixtures/adm/style/acp_bbcodes.html0
-rw-r--r--tests/event/fixtures/normal_events.md.test20
-rw-r--r--tests/event/md_exporter_test.php97
-rw-r--r--tests/functional/acp_attachments_test.php78
-rw-r--r--tests/functional/visibility_softdelete_test.php133
-rw-r--r--tests/functions/fixtures/user_delete.xml46
-rw-r--r--tests/functions/user_delete_test.php112
-rw-r--r--tests/functions_acp/build_cfg_template_test.php2
-rw-r--r--tests/functions_acp/validate_config_vars_test.php96
-rw-r--r--tests/functions_user/delete_user_test.php10
-rw-r--r--tests/lint_test.php51
-rw-r--r--tests/plupload/plupload_test.php53
-rw-r--r--tests/search/mysql_test.php2
-rw-r--r--tests/search/native_test.php2
-rw-r--r--tests/search/postgres_test.php2
-rw-r--r--tests/security/redirect_test.php11
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php12
-rw-r--r--tests/upload/filespec_test.php2
-rwxr-xr-xtravis/check-image-icc-profiles.sh2
-rw-r--r--travis/phpunit-mysqli-travis.xml3
-rwxr-xr-xtravis/setup-webserver.sh10
176 files changed, 3518 insertions, 937 deletions
diff --git a/.jscsrc b/.jscsrc
new file mode 100644
index 0000000000..9dd5ab82e6
--- /dev/null
+++ b/.jscsrc
@@ -0,0 +1,78 @@
+
+{
+ "excludeFiles": ["node_modules/**", "**/build/**"],
+ "requireCurlyBraces": [
+ "if", "else", "for", "while", "do", "try", "catch"
+ ],
+ "requireSpaceBeforeKeywords": [
+ "else", "while", "catch"
+ ],
+ "requireSpaceAfterKeywords": [
+ "do", "for", "if", "else", "switch", "case", "try", "catch", "while", "return", "typeof"
+ ],
+ "requireSpaceBeforeBlockStatements": true,
+ "requireParenthesesAroundIIFE": true,
+ "requireSpacesInConditionalExpression": {
+ "afterTest": true,
+ "beforeConsequent": true,
+ "afterConsequent": true,
+ "beforeAlternate": true
+ },
+ "requireSpacesInAnonymousFunctionExpression": {
+ "beforeOpeningCurlyBrace": true
+ },
+ "disallowSpacesInNamedFunctionExpression": {
+ "beforeOpeningRoundBrace": true
+ },
+ "requireSpacesInFunction": {
+ "beforeOpeningCurlyBrace": true
+ },
+ "disallowSpacesInCallExpression": true,
+ "requireBlocksOnNewline": true,
+ "requirePaddingNewlinesBeforeKeywords": ["case"],
+ "disallowEmptyBlocks": true,
+ "disallowSpacesInsideArrayBrackets": "nested",
+ "disallowSpacesInsideParentheses": true,
+ "requireSpacesInsideObjectBrackets": "all",
+ "disallowQuotedKeysInObjects": "allButReserved",
+ "disallowSpaceAfterObjectKeys": true,
+ "requireSpaceBeforeObjectValues": true,
+ "requireCommaBeforeLineBreak": true,
+ "requireOperatorBeforeLineBreak": [
+ "?", "=", "+", "-", "/", "*", "===", "!==", ">", ">=", "<", "<="
+ ],
+ "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
+ "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
+ "requireSpaceBeforeBinaryOperators": [
+ "=", "+", "+=", "-", "-=", "/", "/=", "*", "*=", "===", "!==", "<", "<=", ">", ">="
+ ],
+ "requireSpaceAfterBinaryOperators": [
+ "=", "+", "+=", "-", "-=", "/", "/=", "*", "*=", "===", "!==", "<", "<=", ">", ">="
+ ],
+ "disallowKeywords": ["with"],
+ "disallowMultipleLineStrings": true,
+ "disallowMixedSpacesAndTabs": "smart",
+ "disallowTrailingWhitespace": true,
+ "disallowTrailingComma": true,
+ "disallowKeywordsOnNewLine": ["else"],
+ "requireLineFeedAtFileEnd": true,
+ "maximumLineLength": {
+ "value": 120,
+ "tabSize": 4,
+ "allowUrlComments": true,
+ "allowRegex": true
+ },
+ "requireCapitalizedConstructors": true,
+ "requireDotNotation": true,
+ "disallowYodaConditions": true,
+ "requireSpaceAfterLineComment": {
+ "allExcept": ["#", "="]
+ },
+ "disallowNewlineBeforeBlockStatements": true,
+ "validateQuoteMarks": {
+ "mark": "'",
+ "escape": true
+ },
+ "validateParameterSeparator": ", ",
+ "safeContextKeyword": ["that"]
+}
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000000..90d3bb613e
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,24 @@
+
+{
+ "bitwise": true,
+ "curly": true,
+ "eqeqeq": true,
+ "es3": true,
+ "forin": false,
+ "freeze": true,
+ "newcap": true,
+ "noarg": true,
+ "noempty": true,
+ "nonbsp": true,
+ "undef": true,
+ "unused": true,
+ "strict": true,
+
+ "browser": true,
+ "devel": true,
+ "jquery": true,
+
+ "globals": {
+ "JSON": true
+ }
+}
diff --git a/.travis.yml b/.travis.yml
index e68ba5f501..2542898324 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -46,6 +46,7 @@ script:
- travis/check-sami-parse-errors.sh $DB $TRAVIS_PHP_VERSION
- travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION
- travis/check-executable-files.sh $DB $TRAVIS_PHP_VERSION ./
+ - sh -c "if [ '$SLOWTESTS' != '1' -a '$DB' = 'mysqli' ]; then phpBB/vendor/bin/phpunit tests/lint_test.php; fi"
- sh -c "if [ '$SLOWTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml; fi"
- sh -c "if [ '$SLOWTESTS' = '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --group slow; fi"
- sh -c "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/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..6996ca22d3
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,6 @@
+## CONTRIBUTE
+
+1. [Create an account on phpBB.com](http://www.phpbb.com/community/ucp.php?mode=register)
+2. [Create a ticket (unless there already is one)](http://tracker.phpbb.com/secure/CreateIssue!default.jspa)
+3. Read our [Coding guidelines](https://wiki.phpbb.com/Coding_guidelines) and [Git Contribution Guidelines](http://wiki.phpbb.com/Git); if you're new to git, also read [the introduction guide](http://wiki.phpbb.com/display/DEV/Working+with+Git)
+4. Send us a pull request
diff --git a/build/build.xml b/build/build.xml
index b0a9190898..59170ab75f 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.4-dev" />
- <property name="prevversion" value="3.1.3" />
- <property name="olderversions" value="3.0.12, 3.0.13, 3.0.13-PL1, 3.1.0, 3.1.1, 3.1.2" />
+ <property name="newversion" value="3.1.5-dev" />
+ <property name="prevversion" value="3.1.4" />
+ <property name="olderversions" value="3.0.12, 3.0.13, 3.0.13-PL1, 3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3" />
<!-- no configuration should be needed beyond this point -->
<property name="oldversions" value="${olderversions}, ${prevversion}" />
@@ -75,14 +75,14 @@
<target name="sniff">
<exec command="phpBB/vendor/bin/phpcs
- -s
+ -s -p
--extensions=php
--standard=build/code_sniffer/ruleset-php-strict-core.xml
--ignore=${project.basedir}/phpBB/phpbb/db/migration/data/v30x/*
phpBB/phpbb"
dir="." returnProperty="retval-php-strict" passthru="true" />
<exec command="phpBB/vendor/bin/phpcs
- -s
+ -s -p
--extensions=php
--standard=build/code_sniffer/ruleset-php-legacy-core.xml
--ignore=${project.basedir}/phpBB/cache/*
@@ -98,7 +98,7 @@
phpBB"
dir="." returnProperty="retval-php-legacy" passthru="true" />
<exec command="phpBB/vendor/bin/phpcs
- -s
+ -s -p
--extensions=php
--standard=build/code_sniffer/ruleset-php-extensions.xml
--ignore=${project.basedir}/phpBB/ext/*/tests/*
diff --git a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
index 8337cf02ee..8c0ec853ff 100644
--- a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
@@ -60,14 +60,14 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
return;
}
// Mark as error if this is not a doc comment
- else if ($start === false || $tokens[$start]['code'] !== T_DOC_COMMENT)
+ else if ($start === false || $tokens[$start]['code'] !== T_DOC_COMMENT_OPEN_TAG)
{
$phpcsFile->addError('Missing required file doc comment.', $stackPtr);
return;
}
// Find comment end token
- $end = $phpcsFile->findNext(T_DOC_COMMENT, $start + 1, null, true) - 1;
+ $end = $tokens[$start]['comment_closer'];
// If there is no end, skip processing here
if ($end === false)
@@ -75,38 +75,30 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
return;
}
- // List of found comment tags
- $tags = array();
-
// check comment lines without the first(/**) an last(*/) line
- for ($i = $start + 1, $c = $end - 1; $i <= $c; ++$i)
+ for ($token = $start + 1, $c = $end - 2; $token <= $c; ++$token)
{
- $line = $tokens[$i]['content'];
-
// Check that each line starts with a '*'
- if (substr($line, 0, 1) !== '*' && substr($line, 0, 2) !== ' *')
+ if ($tokens[$token]['column'] === 1 && (($tokens[$token]['content'] !== '*' && $tokens[$token]['content'] !== ' ') || ($tokens[$token]['content'] === ' ' && $tokens[$token + 1]['content'] !== '*')))
{
$message = 'The file doc comment should not be indented.';
- $phpcsFile->addWarning($message, $i);
- }
- else if (preg_match('/^[ ]?\*\s+@([\w]+)\s+(.*)$/', $line, $match) !== 0)
- {
- if (!isset($tags[$match[1]]))
- {
- $tags[$match[1]] = array();
- }
-
- $tags[$match[1]][] = array($match[2], $i);
+ $phpcsFile->addWarning($message, $token);
}
}
// Check that the first and last line is empty
- if (trim($tokens[$start + 1]['content']) !== '*')
+ // /**T_WHITESPACE
+ // (T_WHITESPACE)*T_WHITESPACE
+ // (T_WHITESPACE)* ...
+ // (T_WHITESPACE)*T_WHITESPACE
+ // T_WHITESPACE*/
+ if (!(($tokens[$start + 2]['content'] !== '*' && $tokens[$start + 4]['content'] !== '*') || ($tokens[$start + 3]['content'] !== '*' && $tokens[$start + 6]['content'] !== '*')))
{
$message = 'The first file comment line should be empty.';
$phpcsFile->addWarning($message, ($start + 1));
}
- if (trim($tokens[$end - 1]['content']) !== '*')
+
+ if ($tokens[$end - 3]['content'] !== '*' && $tokens[$end - 6]['content'] !== '*')
{
$message = 'The last file comment line should be empty.';
$phpcsFile->addWarning($message, $end - 1);
@@ -114,8 +106,8 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
//$this->processPackage($phpcsFile, $start, $tags);
//$this->processVersion($phpcsFile, $start, $tags);
- $this->processCopyright($phpcsFile, $start, $tags);
- $this->processLicense($phpcsFile, $start, $tags);
+ $this->processCopyright($phpcsFile, $start, $tokens[$start]['comment_tags']);
+ $this->processLicense($phpcsFile, $start, $tokens[$start]['comment_tags']);
}
/**
@@ -176,17 +168,24 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{
$copyright = '(c) phpBB Limited <https://www.phpbb.com>';
+ $tokens = $phpcsFile->getTokens();
- if (!isset($tags['copyright']))
+ foreach ($tags as $tag)
{
- $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]);
+ if ($tokens[$tag]['content'] === '@copyright')
+ {
+ if ($tokens[$tag + 2]['content'] !== $copyright)
+ {
+ $message = 'Invalid content found for the first @copyright tag, use "' . $copyright . '".';
+ $phpcsFile->addError($message, $tags['copyright'][0][1]);
+ }
+
+ return;
+ }
}
+
+ $message = 'Missing require @copyright tag in file doc comment.';
+ $phpcsFile->addError($message, $ptr);
}
/**
@@ -201,22 +200,33 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
protected function processLicense(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
{
$license = 'GNU General Public License, version 2 (GPL-2.0)';
+ $tokens = $phpcsFile->getTokens();
- if (!isset($tags['license']))
+ $found = false;
+ foreach ($tags as $tag)
{
- $message = 'Missing require @license tag in file doc comment.';
- $phpcsFile->addError($message, $ptr);
+ if ($tokens[$tag]['content'] === '@license')
+ {
+ if ($found)
+ {
+ $message = 'It must be only one @license tag in file doc comment.';
+ $phpcsFile->addError($message, $ptr);
+ }
+
+ $found = true;
+
+ if ($tokens[$tag + 2]['content'] !== $license)
+ {
+ $message = 'Invalid content found for @license tag, use "' . $license . '".';
+ $phpcsFile->addError($message, $tags['license'][0][1]);
+ }
+ }
}
- else if (sizeof($tags['license']) !== 1)
+
+ if (!$found)
{
- $message = 'It must be only one @license tag in file doc comment.';
+ $message = 'Missing require @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/ControlStructures/OpeningBraceBsdAllmanSniff.php b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php
new file mode 100644
index 0000000000..885c38c5b4
--- /dev/null
+++ b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php
@@ -0,0 +1,143 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+/**
+ * Checks that the opening brace of a control structures is on the line after.
+ * From Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff
+ */
+class phpbb_Sniffs_ControlStructures_OpeningBraceBsdAllmanSniff implements PHP_CodeSniffer_Sniff
+{
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ */
+ public function register()
+ {
+ return array(
+ T_IF,
+ T_ELSE,
+ T_FOREACH,
+ T_WHILE,
+ T_DO,
+ T_FOR,
+ T_SWITCH,
+ );
+ }
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the
+ * stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if (isset($tokens[$stackPtr]['scope_opener']) === false)
+ {
+ return;
+ }
+
+ /*
+ * ...
+ * }
+ * else if ()
+ * {
+ * ...
+ */
+ if ($tokens[$stackPtr]['code'] === T_ELSE && $tokens[$stackPtr + 2]['code'] === T_IF)
+ {
+ return;
+ }
+
+ $openingBrace = $tokens[$stackPtr]['scope_opener'];
+
+ /*
+ * ...
+ * do
+ * {
+ * <code>
+ * } while();
+ * ...
+ * }
+ * else
+ * {
+ * ...
+ */
+ if ($tokens[$stackPtr]['code'] === T_DO ||$tokens[$stackPtr]['code'] === T_ELSE)
+ {
+ $cs_line = $tokens[$stackPtr]['line'];
+ }
+ else
+ {
+ // The end of the function occurs at the end of the argument list. Its
+ // like this because some people like to break long function declarations
+ // over multiple lines.
+ $cs_line = $tokens[$tokens[$stackPtr]['parenthesis_closer']]['line'];
+ }
+
+ $braceLine = $tokens[$openingBrace]['line'];
+
+ $lineDifference = ($braceLine - $cs_line);
+
+ if ($lineDifference === 0)
+ {
+ $error = 'Opening brace should be on a new line';
+ $phpcsFile->addError($error, $openingBrace, 'BraceOnSameLine');
+ return;
+ }
+
+ if ($lineDifference > 1)
+ {
+ $error = 'Opening brace should be on the line after the declaration; found %s blank line(s)';
+ $data = array(($lineDifference - 1));
+ $phpcsFile->addError($error, $openingBrace, 'BraceSpacing', $data);
+ return;
+ }
+
+ // We need to actually find the first piece of content on this line,
+ // as if this is a method with tokens before it (public, static etc)
+ // or an if with an else before it, then we need to start the scope
+ // checking from there, rather than the current token.
+ $lineStart = $stackPtr;
+ while (($lineStart = $phpcsFile->findPrevious(array(T_WHITESPACE), ($lineStart - 1), null, false)) !== false)
+ {
+ if (strpos($tokens[$lineStart]['content'], $phpcsFile->eolChar) !== false)
+ {
+ break;
+ }
+ }
+
+ // We found a new line, now go forward and find the first non-whitespace
+ // token.
+ $lineStart = $phpcsFile->findNext(array(T_WHITESPACE), $lineStart, null, true);
+
+ // The opening brace is on the correct line, now it needs to be
+ // checked to be correctly indented.
+ $startColumn = $tokens[$lineStart]['column'];
+ $braceIndent = $tokens[$openingBrace]['column'];
+
+ if ($braceIndent !== $startColumn)
+ {
+ $error = 'Opening brace indented incorrectly; expected %s spaces, found %s';
+ $data = array(
+ ($startColumn - 1),
+ ($braceIndent - 1),
+ );
+ $phpcsFile->addError($error, $openingBrace, 'BraceIndent', $data);
+ }
+ }
+}
diff --git a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
index 18cb8ba82e..7ffd1aadd6 100644
--- a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
@@ -138,6 +138,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
// Check docblocks
$find = array(
T_COMMENT,
+ T_DOC_COMMENT_CLOSE_TAG,
T_DOC_COMMENT,
T_CLASS,
T_FUNCTION,
@@ -147,43 +148,31 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
$comment_end = $phpcsFile->findPrevious($find, ($function_declaration - 1));
if ($comment_end !== false)
{
- if (!$tokens[$comment_end]['code'] !== T_DOC_COMMENT)
+ if ($tokens[$comment_end]['code'] === T_DOC_COMMENT_CLOSE_TAG)
{
- $comment_start = ($phpcsFile->findPrevious(T_DOC_COMMENT, ($comment_end - 1), null, true) + 1);
- $comment = $phpcsFile->getTokensAsString($comment_start, ($comment_end - $comment_start + 1));
-
- try
- {
- $comment_parser = new PHP_CodeSniffer_CommentParser_FunctionCommentParser($comment, $phpcsFile);
- $comment_parser->parse();
-
- // Check @param
- foreach ($comment_parser->getParams() as $param) {
- $type = $param->getType();
- $types = explode('|', str_replace('[]', '', $type));
- foreach ($types as $type)
- {
- $ok = $this->check($phpcsFile, $type, $class_name_full, $class_name_short, $param->getLine() + $comment_start) ? true : $ok;
- }
+ $comment_start = $tokens[$comment_end]['comment_opener'];
+ foreach ($tokens[$comment_start]['comment_tags'] as $tag) {
+ if ($tokens[$tag]['content'] !== '@param' && $tokens[$tag]['content'] !== '@return' && $tokens[$tag]['content'] !== '@throws') {
+ continue;
}
- // Check @return
- $return = $comment_parser->getReturn();
- if ($return !== null)
+ $classes = $tokens[($tag + 2)]['content'];
+ $space = strpos($classes, ' ');
+ if ($space !== false) {
+ $classes = substr($classes, 0, $space);
+ }
+
+ $tab = strpos($classes, "\t");
+ if ($tab !== false) {
+ $classes = substr($classes, 0, $tab);
+ }
+
+ $classes = explode('|', str_replace('[]', '', $classes));
+ foreach ($classes as $class)
{
- $type = $return->getValue();
- $types = explode('|', str_replace('[]', '', $type));
- foreach ($types as $type)
- {
- $ok = $this->check($phpcsFile, $type, $class_name_full, $class_name_short, $return->getLine() + $comment_start) ? true : $ok;
- }
+ $ok = $this->check($phpcsFile, $class, $class_name_full, $class_name_short, $tokens[$tag + 2]['line']) ? true : $ok;
}
}
- catch (PHP_CodeSniffer_CommentParser_ParserException $e)
- {
- $line = ($e->getLineWithinComment() + $comment_start);
- $phpcsFile->addError($e->getMessage(), $line, 'FailedParse');
- }
}
}
@@ -195,6 +184,20 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
}
}
+ // Checks in catch blocks
+ $old_catch = $stackPtr;
+ while (($catch = $phpcsFile->findNext(T_CATCH, ($old_catch + 1))) !== false)
+ {
+ $old_catch = $catch;
+
+ $caught_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), $catch + 1);
+ $caught_class_name_end = $phpcsFile->findNext($find, $caught_class_name_start + 1, null, true);
+
+ $caught_class_name = trim($phpcsFile->getTokensAsString($caught_class_name_start, ($caught_class_name_end - $caught_class_name_start)));
+
+ $ok = $this->check($phpcsFile, $caught_class_name, $class_name_full, $class_name_short, $catch) ? true : $ok;
+ }
+
if (!$ok)
{
$error = 'There must not be unused USE statements.';
diff --git a/build/code_sniffer/ruleset-minimum.xml b/build/code_sniffer/ruleset-minimum.xml
index 33d0177390..13f122cae7 100644
--- a/build/code_sniffer/ruleset-minimum.xml
+++ b/build/code_sniffer/ruleset-minimum.xml
@@ -12,4 +12,7 @@
<!-- Tabs MUST be used for indentation -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />
+ <!-- ALL braces MUST be on their own lines. -->
+ <rule ref="./phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php" />
+
</ruleset>
diff --git a/build/sami-all.conf.php b/build/sami-all.conf.php
index 68350fee8f..9c10209e8b 100644
--- a/build/sami-all.conf.php
+++ b/build/sami-all.conf.php
@@ -18,13 +18,14 @@ $config['versions'] = Sami\Version\GitVersionCollection::create(__DIR__ . '/../'
This would be nice, but currently causes various problems that need
debugging.
->addFromTags('release-3.0.*')
- ->add('develop-olympus', '3.0-next (olympus)')
+ ->add('3.0.x', '3.0-next (olympus)')
->addFromTags('release-3.1.*')
- ->add('develop-ascraeus', '3.1-next (ascraeus)')
- ->add('develop')
+ ->add('3.1.x', '3.1-next (ascraeus)')
+ ->add('master')
*/
- ->add('develop-olympus')
- ->add('develop-ascraeus')
+ ->add('3.0.x')
+ ->add('3.1.x')
+ ->add('master')
;
return new Sami\Sami($iterator, $config);
diff --git a/composer.phar b/composer.phar
index b00eef5a3e..3481b599b7 100755
--- a/composer.phar
+++ b/composer.phar
Binary files differ
diff --git a/phpBB/adm/style/acp_jabber.html b/phpBB/adm/style/acp_jabber.html
index 4d0b1b0d97..9246987f1f 100644
--- a/phpBB/adm/style/acp_jabber.html
+++ b/phpBB/adm/style/acp_jabber.html
@@ -39,7 +39,7 @@
</dl>
<dl>
<dt><label for="jab_password">{L_JAB_PASSWORD}{L_COLON}</label><br /><span>{L_JAB_PASSWORD_EXPLAIN}</span></dt>
- <dd><input type="password" id="jab_password" name="jab_password" value="{JAB_PASSWORD}" /></dd>
+ <dd><input type="password" id="jab_password" name="jab_password" value="{JAB_PASSWORD}" autocomplete="off" /></dd>
</dl>
<!-- IF S_CAN_USE_SSL -->
<dl>
diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html
index c818a4fc6d..6f7f129d39 100644
--- a/phpBB/adm/style/install_header.html
+++ b/phpBB/adm/style/install_header.html
@@ -2,7 +2,7 @@
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
<head>
<meta charset="utf-8">
-<meta name="viewport" content="width=device-width" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- IF META -->{META}<!-- ENDIF -->
<title>{PAGE_TITLE}</title>
diff --git a/phpBB/adm/style/install_update_diff.html b/phpBB/adm/style/install_update_diff.html
index 150ef37e0e..5f80084705 100644
--- a/phpBB/adm/style/install_update_diff.html
+++ b/phpBB/adm/style/install_update_diff.html
@@ -2,7 +2,7 @@
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
<head>
<meta charset="utf-8">
-<meta name="viewport" content="width=device-width" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- IF META -->{META}<!-- ENDIF -->
<title>{PAGE_TITLE}</title>
diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html
index f1f7eee282..ada88edff2 100644
--- a/phpBB/adm/style/overall_header.html
+++ b/phpBB/adm/style/overall_header.html
@@ -2,7 +2,7 @@
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
<head>
<meta charset="utf-8">
-<meta name="viewport" content="width=device-width" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- IF META -->{META}<!-- ENDIF -->
<title>{PAGE_TITLE}</title>
diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html
index d0b9bf62ed..f62a7a900e 100644
--- a/phpBB/adm/style/simple_header.html
+++ b/phpBB/adm/style/simple_header.html
@@ -2,6 +2,7 @@
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
<head>
<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- IF META -->{META}<!-- ENDIF -->
<title>{PAGE_TITLE}</title>
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index 806db7d35f..cc016e52ee 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -1,3 +1,5 @@
+/* global bbfontstyle */
+
var phpbb = {};
phpbb.alertTime = 100;
@@ -13,7 +15,7 @@ var keymap = {
};
var $dark = $('#darkenwrapper');
-var $loadingIndicator = $('#loading_indicator');
+var $loadingIndicator;
var phpbbAlertTimer = null;
phpbb.isTouch = (window && typeof window.ontouchstart !== 'undefined');
@@ -21,9 +23,14 @@ phpbb.isTouch = (window && typeof window.ontouchstart !== 'undefined');
/**
* Display a loading screen
*
- * @returns object Returns loadingIndicator.
+ * @returns {object} Returns loadingIndicator.
*/
phpbb.loadingIndicator = function() {
+ if (!$loadingIndicator) {
+ $loadingIndicator = $('<div />', { id: 'loading_indicator' });
+ $loadingIndicator.appendTo('#page-footer');
+ }
+
if (!$loadingIndicator.is(':visible')) {
$loadingIndicator.fadeIn(phpbb.alertTime);
// Wait fifteen seconds and display an error if nothing has been returned by then.
@@ -54,7 +61,7 @@ phpbb.clearLoadingTimeout = function() {
/**
* Close popup alert after a specified delay
*
-* @param int Delay in ms until darkenwrapper's click event is triggered
+* @param {int} delay Delay in ms until darkenwrapper's click event is triggered
*/
phpbb.closeDarkenWrapper = function(delay) {
phpbbAlertTimer = setTimeout(function() {
@@ -67,14 +74,12 @@ phpbb.closeDarkenWrapper = function(delay) {
*
* You can only call one alert or confirm box at any one time.
*
- * @param string title Title of the message, eg "Information" (HTML).
- * @param string msg Message to display (HTML).
- * @param bool fadedark Remove the dark background when done? Defaults
- * to yes.
+ * @param {string} title Title of the message, eg "Information" (HTML).
+ * @param {string} msg Message to display (HTML).
*
- * @returns object Returns the div created.
+ * @returns {object} Returns the div created.
*/
-phpbb.alert = function(title, msg, fadedark) {
+phpbb.alert = function(title, msg) {
var $alert = $('#phpbb_alert');
$alert.find('.alert_title').html(title);
$alert.find('.alert_text').html(msg);
@@ -94,7 +99,7 @@ phpbb.alert = function(title, msg, fadedark) {
/**
* Handler for opening an alert box.
*
-* @param jQuery $alert jQuery object.
+* @param {jQuery} $alert jQuery object.
*/
phpbb.alert.open = function($alert) {
if (!$dark.is(':visible')) {
@@ -134,8 +139,8 @@ phpbb.alert.open = function($alert) {
/**
* Handler for closing an alert box.
*
-* @param jQuery $alert jQuery object.
-* @param bool fadedark Whether to remove dark background.
+* @param {jQuery} $alert jQuery object.
+* @param {bool} fadedark Whether to remove dark background.
*/
phpbb.alert.close = function($alert, fadedark) {
var $fade = (fadedark) ? $dark : $alert;
@@ -153,13 +158,13 @@ phpbb.alert.close = function($alert, fadedark) {
*
* You can only call one alert or confirm box at any one time.
*
- * @param string msg Message to display (HTML).
- * @param function callback Callback. Bool param, whether the user pressed
+ * @param {string} msg Message to display (HTML).
+ * @param {function} callback Callback. Bool param, whether the user pressed
* yes or no (or whatever their language is).
- * @param bool fadedark Remove the dark background when done? Defaults
+ * @param {bool} fadedark Remove the dark background when done? Defaults
* to yes.
*
- * @returns object Returns the div created.
+ * @returns {object} Returns the div created.
*/
phpbb.confirm = function(msg, callback, fadedark) {
var $confirmDiv = $('#phpbb_confirm');
@@ -197,8 +202,8 @@ phpbb.confirm = function(msg, callback, fadedark) {
/**
* Turn a querystring into an array.
*
- * @argument string string The querystring to parse.
- * @returns object The object created.
+ * @argument {string} string The querystring to parse.
+ * @returns {object} The object created.
*/
phpbb.parseQuerystring = function(string) {
var params = {}, i, split;
@@ -223,12 +228,7 @@ phpbb.parseQuerystring = function(string) {
* For more info, view the following page on the phpBB wiki:
* http://wiki.phpbb.com/JavaScript_Function.phpbb.ajaxify
*
- * @param object options Options.
- * @param bool/function refresh If we are sent back a refresh, should it be
- * acted upon? This can either be true / false / a function.
- * @param function callback Callback to call on completion of event. Has
- * three parameters: the element that the event was evoked from, the JSON
- * that was returned and (if it is a form) the form action.
+ * @param {object} options Options.
*/
phpbb.ajaxify = function(options) {
var $elements = $(options.selector),
@@ -262,11 +262,16 @@ phpbb.ajaxify = function(options) {
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown);
}
phpbb.clearLoadingTimeout();
- var errorText = false;
- if (typeof errorThrown === 'string' && errorThrown.length > 0) {
+ var responseText, errorText = false;
+ try {
+ responseText = JSON.parse(jqXHR.responseText);
+ responseText = responseText.message;
+ } catch (e) {}
+ if (typeof responseText === 'string' && responseText.length > 0) {
+ errorText = responseText;
+ } else if (typeof errorThrown === 'string' && errorThrown.length > 0) {
errorText = errorThrown;
- }
- else {
+ } else {
errorText = $dark.attr('data-ajax-error-text-' + textStatus);
if (typeof errorText !== 'string' || !errorText.length) {
errorText = $dark.attr('data-ajax-error-text');
@@ -283,7 +288,7 @@ phpbb.ajaxify = function(options) {
* It cannot be called from outside this function, and is purely here to
* avoid repetition of code.
*
- * @param object res The object sent back by the server.
+ * @param {object} res The object sent back by the server.
*/
function returnHandler(res) {
var alert;
@@ -427,10 +432,10 @@ phpbb.search = {
};
/**
- * Get cached search data.
+ * Get cached search data.
*
- * @param string id Search ID.
- * @return bool|object. Cached data object. Returns false if no data exists.
+ * @param {string} id Search ID.
+ * @returns {bool|object} Cached data object. Returns false if no data exists.
*/
phpbb.search.cache.get = function(id) {
if (this.data[id]) {
@@ -440,39 +445,35 @@ phpbb.search.cache.get = function(id) {
};
/**
- * Set search cache data value.
+ * Set search cache data value.
*
- * @param string id Search ID.
- * @param string key Data key.
- * @param string value Data value.
- *
- * @return undefined
+ * @param {string} id Search ID.
+ * @param {string} key Data key.
+ * @param {string} value Data value.
*/
phpbb.search.cache.set = function(id, key, value) {
if (!this.data[id]) {
- this.data[id] = {results: []};
+ this.data[id] = { results: [] };
}
this.data[id][key] = value;
};
/**
- * Cache search result.
- *
- * @param string id Search ID.
- * @param string keyword Keyword.
- * @param array results Search results.
+ * Cache search result.
*
- * @return undefined
+ * @param {string} id Search ID.
+ * @param {string} keyword Keyword.
+ * @param {Array} results Search results.
*/
-phpbb.search.cache.setResults = function(id, keyword, value) {
- this.data[id].results[keyword] = value;
+phpbb.search.cache.setResults = function(id, keyword, results) {
+ this.data[id].results[keyword] = results;
};
/**
* Trim spaces from keyword and lower its case.
*
- * @param string keyword Search keyword to clean.
- * @return string Cleaned string.
+ * @param {string} keyword Search keyword to clean.
+ * @returns {string} Cleaned string.
*/
phpbb.search.cleanKeyword = function(keyword) {
return $.trim(keyword).toLowerCase();
@@ -482,11 +483,11 @@ phpbb.search.cleanKeyword = function(keyword) {
* Get clean version of search keyword. If textarea supports several keywords
* (one per line), it fetches the current keyword based on the caret position.
*
- * @param jQuery $input Search input|textarea.
- * @param string keyword Input|textarea value.
- * @param bool multiline Whether textarea supports multiple search keywords.
+ * @param {jQuery} $input Search input|textarea.
+ * @param {string} keyword Input|textarea value.
+ * @param {bool} multiline Whether textarea supports multiple search keywords.
*
- * @return string Clean string.
+ * @returns string Clean string.
*/
phpbb.search.getKeyword = function($input, keyword, multiline) {
if (multiline) {
@@ -498,10 +499,10 @@ phpbb.search.getKeyword = function($input, keyword, multiline) {
/**
* Get the textarea line number on which the keyword resides - for textareas
- * that support multiple keywords (one per line).
+ * that support multiple keywords (one per line).
*
- * @param jQuery $textarea Search textarea.
- * @return int
+ * @param {jQuery} $textarea Search textarea.
+ * @returns {int} The line number.
*/
phpbb.search.getKeywordLine = function ($textarea) {
var selectionStart = $textarea.get(0).selectionStart;
@@ -512,11 +513,9 @@ phpbb.search.getKeywordLine = function ($textarea) {
* Set the value on the input|textarea. If textarea supports multiple
* keywords, only the active keyword is replaced.
*
- * @param jQuery $input Search input|textarea.
- * @param string value Value to set.
- * @param bool multiline Whether textarea supports multiple search keywords.
- *
- * @return undefined
+ * @param {jQuery} $input Search input|textarea.
+ * @param {string} value Value to set.
+ * @param {bool} multiline Whether textarea supports multiple search keywords.
*/
phpbb.search.setValue = function($input, value, multiline) {
if (multiline) {
@@ -529,14 +528,13 @@ phpbb.search.setValue = function($input, value, multiline) {
};
/**
- * Sets the onclick event to set the value on the input|textarea to the selected search result.
- *
- * @param jQuery $input Search input|textarea.
- * @param object value Result object.
- * @param jQuery $row Result element.
- * @param jQuery $container jQuery object for the search container.
+ * Sets the onclick event to set the value on the input|textarea to the
+ * selected search result.
*
- * @return undefined
+ * @param {jQuery} $input Search input|textarea.
+ * @param {object} value Result object.
+ * @param {jQuery} $row Result element.
+ * @param {jQuery} $container jQuery object for the search container.
*/
phpbb.search.setValueOnClick = function($input, value, $row, $container) {
$row.click(function() {
@@ -551,16 +549,16 @@ phpbb.search.setValueOnClick = function($input, value, $row, $container) {
* already, those are displayed instead. Executes the AJAX request function
* itself due to the need to use a timeout to limit the number of requests.
*
- * @param array data Data to be sent to the server.
- * @param object event Onkeyup event object.
- * @param function sendRequest Function to execute AJAX request.
+ * @param {Array} data Data to be sent to the server.
+ * @param {object} event Onkeyup event object.
+ * @param {function} sendRequest Function to execute AJAX request.
*
- * @return bool Returns false.
+ * @returns {bool} Returns false.
*/
phpbb.search.filter = function(data, event, sendRequest) {
var $this = $(this),
dataName = ($this.attr('data-name') !== undefined) ? $this.attr('data-name') : $this.attr('name'),
- minLength = parseInt($this.attr('data-min-length')),
+ minLength = parseInt($this.attr('data-min-length'), 10),
searchID = $this.attr('data-results'),
keyword = phpbb.search.getKeyword($this, data[dataName], $this.attr('data-multiline')),
cache = phpbb.search.cache.get(searchID),
@@ -582,7 +580,10 @@ phpbb.search.filter = function(data, event, sendRequest) {
} else {
// Do we already have results for this?
if (cache.results[keyword]) {
- var response = {keyword: keyword, results: cache.results[keyword]};
+ var response = {
+ keyword: keyword,
+ results: cache.results[keyword]
+ };
phpbb.search.handleResponse(response, $this, true);
proceed = false;
}
@@ -593,8 +594,8 @@ phpbb.search.filter = function(data, event, sendRequest) {
phpbb.search.cache.set(searchID, 'lastSearch', keyword);
phpbb.search.cache.setResults(searchID, keyword, []);
proceed = false;
- }
- }
+ }
+ }
}
if (proceed) {
@@ -607,14 +608,12 @@ phpbb.search.filter = function(data, event, sendRequest) {
};
/**
- * Handle search result response.
+ * Handle search result response.
*
- * @param object res Data received from server.
- * @param jQuery $input Search input|textarea.
- * @param bool fromCache Whether the results are from the cache.
- * @param function callback Optional callback to run when assigning each search result.
- *
- * @return undefined
+ * @param {object} res Data received from server.
+ * @param {jQuery} $input Search input|textarea.
+ * @param {bool} fromCache Whether the results are from the cache.
+ * @param {function} callback Optional callback to run when assigning each search result.
*/
phpbb.search.handleResponse = function(res, $input, fromCache, callback) {
if (typeof res !== 'object') {
@@ -641,12 +640,10 @@ phpbb.search.handleResponse = function(res, $input, fromCache, callback) {
/**
* Show search results.
*
- * @param array results Search results.
- * @param jQuery $input Search input|textarea.
- * @param jQuery $container Search results container element.
- * @param function callback Optional callback to run when assigning each search result.
- *
- * @return undefined
+ * @param {Array} results Search results.
+ * @param {jQuery} $input Search input|textarea.
+ * @param {jQuery} $container Search results container element.
+ * @param {function} callback Optional callback to run when assigning each search result.
*/
phpbb.search.showResults = function(results, $input, $container, callback) {
var $resultContainer = $('.search-results', $container);
@@ -683,8 +680,7 @@ phpbb.search.showResults = function(results, $input, $container, callback) {
/**
* Clear search results.
*
- * @param jQuery $container Search results container.
- * @return undefined
+ * @param {jQuery} $container Search results container.
*/
phpbb.search.clearResults = function($container) {
$container.children(':not(.search-result-tpl)').remove();
@@ -703,8 +699,8 @@ phpbb.history = {};
/**
* Check whether a method in the native history object is supported.
*
-* @param string fn Method name.
-* @return bool Returns true if the method is supported.
+* @param {string} fn Method name.
+* @returns {bool} Returns true if the method is supported.
*/
phpbb.history.isSupported = function(fn) {
return !(typeof history === 'undefined' || typeof history[fn] === 'undefined');
@@ -714,12 +710,10 @@ phpbb.history.isSupported = function(fn) {
* Wrapper for the pushState and replaceState methods of the
* native history object.
*
-* @param string mode Mode. Either push or replace.
-* @param string url New URL.
-* @param string title Optional page title.
-* @patam object obj Optional state object.
-*
-* @return undefined
+* @param {string} mode Mode. Either push or replace.
+* @param {string} url New URL.
+* @param {string} [title] Optional page title.
+* @param {object} [obj] Optional state object.
*/
phpbb.history.alterUrl = function(mode, url, title, obj) {
var fn = mode + 'State';
@@ -740,11 +734,9 @@ phpbb.history.alterUrl = function(mode, url, title, obj) {
/**
* Wrapper for the native history.replaceState method.
*
-* @param string url New URL.
-* @param string title Optional page title.
-* @patam object obj Optional state object.
-*
-* @return undefined
+* @param {string} url New URL.
+* @param {string} [title] Optional page title.
+* @param {object} [obj] Optional state object.
*/
phpbb.history.replaceUrl = function(url, title, obj) {
phpbb.history.alterUrl('replace', url, title, obj);
@@ -753,11 +745,9 @@ phpbb.history.replaceUrl = function(url, title, obj) {
/**
* Wrapper for the native history.pushState method.
*
-* @param string url New URL.
-* @param string title Optional page title.
-* @patam object obj Optional state object.
-*
-* @return undefined
+* @param {string} url New URL.
+* @param {string} [title] Optional page title.
+* @param {object} [obj] Optional state object.
*/
phpbb.history.pushUrl = function(url, title, obj) {
phpbb.history.alterUrl('push', url, title, obj);
@@ -766,7 +756,8 @@ phpbb.history.pushUrl = function(url, title, obj) {
/**
* Hide the optgroups that are not the selected timezone
*
-* @param bool keepSelection Shall we keep the value selected, or shall the user be forced to repick one.
+* @param {bool} keepSelection Shall we keep the value selected, or shall the
+* user be forced to repick one.
*/
phpbb.timezoneSwitchDate = function(keepSelection) {
var $timezoneCopy = $('#timezone_copy');
@@ -789,7 +780,7 @@ phpbb.timezoneSwitchDate = function(keepSelection) {
}
if ($tzDate.val() !== '') {
- $timezone.children('optgroup').remove(':not([data-tz-value="' + $('#tz_date').val() + '"])');
+ $timezone.children('optgroup').remove(':not([data-tz-value="' + $tzDate.val() + '"])');
}
if ($tzDate.val() === $tzSelectDateSuggest.attr('data-suggested-tz')) {
@@ -797,7 +788,7 @@ phpbb.timezoneSwitchDate = function(keepSelection) {
} else {
$tzSelectDateSuggest.css('display', 'inline');
}
-
+
var $tzOptions = $timezone.children('optgroup[data-tz-value="' + $tzDate.val() + '"]').children('option');
if ($tzOptions.length === 1) {
@@ -824,7 +815,7 @@ phpbb.timezoneEnableDateSelection = function() {
/**
* Preselect a date/time or suggest one, if it is not picked.
*
-* @param bool forceSelector Shall we select the suggestion?
+* @param {bool} forceSelector Shall we select the suggestion?
*/
phpbb.timezonePreselectSelect = function(forceSelector) {
@@ -893,8 +884,8 @@ phpbb.ajaxCallbacks = {};
*
* See the phpbb.ajaxify comments for information on stuff like parameters.
*
- * @param string id The name of the callback.
- * @param function callback The callback to be called.
+ * @param {string} id The name of the callback.
+ * @param {function} callback The callback to be called.
*/
phpbb.addAjaxCallback = function(id, callback) {
if (typeof callback === 'function') {
@@ -985,7 +976,7 @@ phpbb.addAjaxCallback('toggle_link', function() {
* types text.
*
* @param {jQuery} $items jQuery object(s) to resize
-* @param {object} options Optional parameter that adjusts default
+* @param {object} [options] Optional parameter that adjusts default
* configuration. See configuration variable
*
* Optional parameters:
@@ -1022,15 +1013,19 @@ phpbb.resizeTextArea = function($items, options) {
function resetAutoResize(item) {
var $item = $(item);
if ($item.hasClass('auto-resized')) {
- $(item).css({height: '', resize: ''}).removeClass('auto-resized');
+ $(item)
+ .css({ height: '', resize: '' })
+ .removeClass('auto-resized');
configuration.resetCallback.call(item, $item);
}
}
function autoResize(item) {
function setHeight(height) {
- height += parseInt($item.css('height')) - $item.height();
- $item.css({height: height + 'px', resize: 'none'}).addClass('auto-resized');
+ height += parseInt($item.css('height'), 10) - $item.height();
+ $item
+ .css({ height: height + 'px', resize: 'none' })
+ .addClass('auto-resized');
configuration.resizeCallback.call(item, $item);
}
@@ -1046,7 +1041,7 @@ phpbb.resizeTextArea = function($items, options) {
configuration.maxHeight
),
$item = $(item),
- height = parseInt($item.height()),
+ height = parseInt($item.height(), 10),
scrollHeight = (item.scrollHeight) ? item.scrollHeight : 0;
if (height < 0) {
@@ -1055,8 +1050,7 @@ phpbb.resizeTextArea = function($items, options) {
if (height > maxHeight) {
setHeight(maxHeight);
- }
- else if (scrollHeight > (height + 5)) {
+ } else if (scrollHeight > (height + 5)) {
setHeight(Math.min(maxHeight, scrollHeight));
}
}
@@ -1085,7 +1079,7 @@ phpbb.resizeTextArea = function($items, options) {
* @param {Array} endTags List of end tags to look for
* For example, Array('[/code]')
*
-* @return {boolean} True if cursor is in bbcode tag
+* @returns {boolean} True if cursor is in bbcode tag
*/
phpbb.inBBCodeTag = function(textarea, startTags, endTags) {
var start = textarea.selectionStart,
@@ -1157,7 +1151,7 @@ phpbb.applyCodeEditor = function(textarea) {
* @param {boolean} stripCodeStart If true, only part of line
* after [code] tag will be returned.
*
- * @return {string} Line of text
+ * @returns {string} Line of text
*/
function getLastLine(stripCodeStart) {
var start = textarea.selectionStart,
@@ -1173,7 +1167,7 @@ phpbb.applyCodeEditor = function(textarea) {
var tagLength = startTags[i].length;
value = value.substring(index + tagLength);
- if (startTags[i].lastIndexOf(startTagsEnd) != tagLength) {
+ if (startTags[i].lastIndexOf(startTagsEnd) !== tagLength) {
index = value.indexOf(startTagsEnd);
if (index >= 0) {
@@ -1190,7 +1184,7 @@ phpbb.applyCodeEditor = function(textarea) {
/**
* Append text at cursor position
*
- * @param {string} Text Text to append
+ * @param {string} text Text to append
*/
function appendText(text) {
var start = textarea.selectionStart,
@@ -1233,6 +1227,31 @@ phpbb.applyCodeEditor = function(textarea) {
};
/**
+ * Show drag and drop animation when textarea is present
+ *
+ * This function will enable the drag and drop animation for a specified
+ * textarea.
+ *
+ * @param {HTMLElement} textarea Textarea DOM object to apply editor to
+ */
+phpbb.showDragNDrop = function(textarea) {
+ if (!textarea) {
+ return;
+ }
+
+ $('body').on('dragenter dragover', function () {
+ $(textarea).addClass('drag-n-drop');
+ }).on('dragleave dragout dragend drop', function() {
+ $(textarea).removeClass('drag-n-drop');
+ });
+ $(textarea).on('dragenter dragover', function () {
+ $(textarea).addClass('drag-n-drop-highlight');
+ }).on('dragleave dragout dragend drop', function() {
+ $(textarea).removeClass('drag-n-drop-highlight');
+ });
+};
+
+/**
* List of classes that toggle dropdown menu,
* list of classes that contain visible dropdown menu
*
@@ -1324,12 +1343,15 @@ phpbb.toggleDropdown = function() {
fullFreeSpace = freeSpace + parent.outerWidth();
options.dropdown.find('.dropdown-contents').each(function() {
- contentWidth = parseInt($(this).outerWidth());
- $(this).css({marginLeft: 0, left: 0});
+ contentWidth = parseInt($(this).outerWidth(), 10);
+ $(this).css({ marginLeft: 0, left: 0 });
});
var maxOffset = Math.min(contentWidth, fullFreeSpace) + 'px';
- options.dropdown.css({'width': maxOffset, 'margin-left': '-' + maxOffset});
+ options.dropdown.css({
+ width: maxOffset,
+ marginLeft: -maxOffset
+ });
}
} else {
options.dropdown.css('margin-right', '-' + (windowWidth + freeSpace) + 'px');
@@ -1391,14 +1413,12 @@ phpbb.registerDropdown = function(toggle, dropdown, options) {
/**
* Get the HTML for a color palette table.
*
-* @param string dir Palette direction - either v or h
-* @param int width Palette cell width.
-* @param int height Palette cell height.
+* @param {string} dir Palette direction - either v or h
+* @param {int} width Palette cell width.
+* @param {int} height Palette cell height.
*/
phpbb.colorPalette = function(dir, width, height) {
- var r = 0,
- g = 0,
- b = 0,
+ var r, g, b,
numberList = new Array(6),
color = '',
html = '';
@@ -1409,32 +1429,33 @@ phpbb.colorPalette = function(dir, width, height) {
numberList[3] = 'BF';
numberList[4] = 'FF';
- var tableClass = (dir == 'h') ? 'horizontal-palette' : 'vertical-palette';
+ var tableClass = (dir === 'h') ? 'horizontal-palette' : 'vertical-palette';
html += '<table class="not-responsive colour-palette ' + tableClass + '" style="width: auto;">';
for (r = 0; r < 5; r++) {
- if (dir == 'h') {
+ if (dir === 'h') {
html += '<tr>';
}
for (g = 0; g < 5; g++) {
- if (dir == 'v') {
+ if (dir === 'v') {
html += '<tr>';
}
for (b = 0; b < 5; b++) {
- color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
- html += '<td style="background-color: #' + color + '; width: ' + width + 'px; height: ' + height + 'px;">';
- html += '<a href="#" data-color="' + color + '" style="display: block; width: ' + width + 'px; height: ' + height + 'px; " alt="#' + color + '" title="#' + color + '"></a>';
+ color = '' + numberList[r] + numberList[g] + numberList[b];
+ html += '<td style="background-color: #' + color + '; width: ' + width + 'px; height: ' +
+ height + 'px;"><a href="#" data-color="' + color + '" style="display: block; width: ' +
+ width + 'px; height: ' + height + 'px; " alt="#' + color + '" title="#' + color + '"></a>';
html += '</td>';
}
- if (dir == 'v') {
+ if (dir === 'v') {
html += '</tr>';
}
}
- if (dir == 'h') {
+ if (dir === 'h') {
html += '</tr>';
}
}
@@ -1445,7 +1466,7 @@ phpbb.colorPalette = function(dir, width, height) {
/**
* Register a color palette.
*
-* @param object el jQuery object for the palette container.
+* @param {jQuery} el jQuery object for the palette container.
*/
phpbb.registerPalette = function(el) {
var orientation = el.attr('data-orientation'),
@@ -1474,15 +1495,15 @@ phpbb.registerPalette = function(el) {
}
e.preventDefault();
});
-}
+};
/**
* Set display of page element
*
-* @param string id The ID of the element to change
-* @param int action Set to 0 if element display should be toggled, -1 for
+* @param {string} id The ID of the element to change
+* @param {int} action Set to 0 if element display should be toggled, -1 for
* hiding the element, and 1 for showing it.
-* @param string type Display type that should be used, e.g. inline, block or
+* @param {string} type Display type that should be used, e.g. inline, block or
* other CSS "display" types
*/
phpbb.toggleDisplay = function(id, action, type) {
@@ -1503,8 +1524,7 @@ phpbb.toggleDisplay = function(id, action, type) {
* Toggle additional settings based on the selected
* option of select element.
*
-* @param jQuery el jQuery select element object.
-* @return undefined
+* @param {jQuery} el jQuery select element object.
*/
phpbb.toggleSelectSettings = function(el) {
el.children().each(function() {
@@ -1518,11 +1538,11 @@ phpbb.toggleSelectSettings = function(el) {
* Get function from name.
* Based on http://stackoverflow.com/a/359910
*
-* @param string functionName Function to get.
-* @return function
+* @param {string} functionName Function to get.
+* @returns function
*/
phpbb.getFunctionByName = function (functionName) {
- var namespaces = functionName.split('.'),
+ var namespaces = functionName.split('.'),
func = namespaces.pop(),
context = window;
diff --git a/phpBB/assets/javascript/editor.js b/phpBB/assets/javascript/editor.js
index 5fd4f7eae3..298526ab1f 100644
--- a/phpBB/assets/javascript/editor.js
+++ b/phpBB/assets/javascript/editor.js
@@ -159,7 +159,7 @@ function insert_text(text, spaces, popup) {
/**
* Add inline attachment at position
*/
-function attach_inline(index, filename) {
+function attachInline(index, filename) {
insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
document.forms[form_name].elements[text_name].focus();
}
@@ -355,6 +355,9 @@ function getCaretPosition(txtarea) {
textarea = doc.forms[form_name].elements[text_name];
phpbb.applyCodeEditor(textarea);
+ if ($('#attach-panel').length) {
+ phpbb.showDragNDrop(textarea);
+ }
});
})(jQuery);
diff --git a/phpBB/assets/javascript/plupload.js b/phpBB/assets/javascript/plupload.js
index a58c71e64d..96e5ca96e6 100644
--- a/phpBB/assets/javascript/plupload.js
+++ b/phpBB/assets/javascript/plupload.js
@@ -1,26 +1,26 @@
+/* global phpbb, plupload, attachInline */
+
plupload.addI18n(phpbb.plupload.i18n);
phpbb.plupload.ids = [];
(function($) { // Avoid conflicts with other libraries
-"use strict";
+'use strict';
/**
* Set up the uploader.
- *
- * @return undefined
*/
phpbb.plupload.initialize = function() {
// Initialize the Plupload uploader.
- uploader.init();
+ phpbb.plupload.uploader.init();
// Set attachment data.
phpbb.plupload.setData(phpbb.plupload.data);
phpbb.plupload.updateMultipartParams(phpbb.plupload.getSerializedData());
// Only execute if Plupload initialized successfully.
- uploader.bind('Init', function() {
- phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0],
+ phpbb.plupload.uploader.bind('Init', function() {
+ phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0];
phpbb.plupload.rowTpl = $('#attach-row-tpl')[0].outerHTML;
// Hide the basic upload panel and remove the attach row template.
@@ -29,18 +29,18 @@ phpbb.plupload.initialize = function() {
$('#attach-panel-multi').show();
});
- uploader.bind('PostInit', function() {
+ phpbb.plupload.uploader.bind('PostInit', function() {
// Point out the drag-and-drop zone if it's supported.
- if (uploader.features.dragdrop) {
+ if (phpbb.plupload.uploader.features.dragdrop) {
$('#drag-n-drop-message').show();
}
// Ensure "Add files" button position is correctly calculated.
if ($('#attach-panel-multi').is(':visible')) {
- uploader.refresh();
+ phpbb.plupload.uploader.refresh();
}
$('[data-subpanel="attach-panel"]').one('click', function() {
- uploader.refresh();
+ phpbb.plupload.uploader.refresh();
});
});
};
@@ -48,37 +48,32 @@ phpbb.plupload.initialize = function() {
/**
* Unsets all elements in the object uploader.settings.multipart_params whose keys
* begin with 'attachment_data['
- *
- * @return undefined
*/
phpbb.plupload.clearParams = function() {
- var obj = uploader.settings.multipart_params;
+ var obj = phpbb.plupload.uploader.settings.multipart_params;
for (var key in obj) {
if (!obj.hasOwnProperty(key) || key.indexOf('attachment_data[') !== 0) {
continue;
}
- delete uploader.settings.multipart_params[key];
+ delete phpbb.plupload.uploader.settings.multipart_params[key];
}
};
/**
* Update uploader.settings.multipart_params object with new data.
*
- * @param object obj
- * @return undefined
+ * @param {object} obj
*/
phpbb.plupload.updateMultipartParams = function(obj) {
- uploader.settings.multipart_params = $.extend(
- uploader.settings.multipart_params,
- obj
- );
+ var settings = phpbb.plupload.uploader.settings;
+ settings.multipart_params = $.extend(settings.multipart_params, obj);
};
/**
* Convert the array of attachment objects into an object that PHP would expect as POST data.
*
- * @return object An object in the form 'attachment_data[i][key]': value as
+ * @returns {object} An object in the form 'attachment_data[i][key]': value as
* expected by the server
*/
phpbb.plupload.getSerializedData = function() {
@@ -100,22 +95,19 @@ phpbb.plupload.getSerializedData = function() {
* Get the index from the phpbb.plupload.data array where the given
* attachment id appears.
*
- * @param int attach_id The attachment id of the file.
- * @return bool Returns false if the id cannot be found.
- * @return int Returns the index of the file if it exists.
+ * @param {int} attachId The attachment id of the file.
+ * @returns {bool|int} Index of the file if exists, otherwise false.
*/
-phpbb.plupload.getIndex = function(attach_id) {
- var index = $.inArray(Number(attach_id), phpbb.plupload.ids);
+phpbb.plupload.getIndex = function(attachId) {
+ var index = $.inArray(Number(attachId), phpbb.plupload.ids);
return (index !== -1) ? index : false;
};
/**
* Set the data in phpbb.plupload.data and phpbb.plupload.ids arrays.
- *
- * @param array data Array containing the new data to use. In the form of
- * array(index => object(property: value). Requires attach_id to be one of the object properties.
*
- * @return undefined
+ * @param {Array} data Array containing the new data to use. In the form of
+ * array(index => object(property: value). Requires attach_id to be one of the object properties.
*/
phpbb.plupload.setData = function(data) {
// Make sure that the array keys are reset.
@@ -129,12 +121,11 @@ phpbb.plupload.setData = function(data) {
/**
* Update the attachment data in the HTML and the phpbb & phpbb.plupload objects.
- *
- * @param array data Array containing the new data to use.
- * @param string action The action that required the update. Used to update the inline attachment bbcodes.
- * @param int index The index from phpbb.plupload_ids that was affected by the action.
- * @param array downloadUrl Optional array of download urls to update.
- * @return undefined
+ *
+ * @param {Array} data Array containing the new data to use.
+ * @param {string} action The action that required the update. Used to update the inline attachment bbcodes.
+ * @param {int} index The index from phpbb.plupload_ids that was affected by the action.
+ * @param {Array} downloadUrl Optional array of download urls to update.
*/
phpbb.plupload.update = function(data, action, index, downloadUrl) {
@@ -147,9 +138,8 @@ phpbb.plupload.update = function(data, action, index, downloadUrl) {
/**
* Update the relevant elements and hidden data for all attachments.
- *
- * @param array downloadUrl Optional array of download urls to update.
- * @return undefined
+ *
+ * @param {Array} downloadUrl Optional array of download urls to update.
*/
phpbb.plupload.updateRows = function(downloadUrl) {
for (var i = 0; i < phpbb.plupload.ids.length; i++) {
@@ -162,9 +152,8 @@ phpbb.plupload.updateRows = function(downloadUrl) {
* using the id "attach-row-tpl" to be present. This snippet is cloned and the
* data for the file inserted into it. The row is then appended or prepended to
* #file-list based on the attach_order setting.
- *
- * @param object file Plupload file object for the new attachment.
- * @return undefined
+ *
+ * @param {object} file Plupload file object for the new attachment.
*/
phpbb.plupload.insertRow = function(file) {
var row = $(phpbb.plupload.rowTpl);
@@ -173,7 +162,7 @@ phpbb.plupload.insertRow = function(file) {
row.find('.file-name').html(plupload.xmlEncode(file.name));
row.find('.file-size').html(plupload.formatSize(file.size));
- if (phpbb.plupload.order == 'desc') {
+ if (phpbb.plupload.order === 'desc') {
$('#file-list').prepend(row);
} else {
$('#file-list').append(row);
@@ -182,10 +171,9 @@ phpbb.plupload.insertRow = function(file) {
/**
* Update the relevant elements and hidden data for an attachment.
- *
- * @param int index The index from phpbb.plupload.ids of the attachment to edit.
- * @param array downloadUrl Optional array of download urls to update.
- * @return undefined
+ *
+ * @param {int} index The index from phpbb.plupload.ids of the attachment to edit.
+ * @param {Array} downloadUrl Optional array of download urls to update.
*/
phpbb.plupload.updateRow = function(index, downloadUrl) {
var attach = phpbb.plupload.data[index],
@@ -197,7 +185,7 @@ phpbb.plupload.updateRow = function(index, downloadUrl) {
link = $('<a></a>');
link.attr('href', url).html(attach.real_filename);
- row.find('.file-name').html(link)
+ row.find('.file-name').html(link);
}
row.find('textarea').attr('name', 'comment_list[' + index + ']');
@@ -207,18 +195,21 @@ phpbb.plupload.updateRow = function(index, downloadUrl) {
/**
* Update hidden input data for an attachment.
*
- * @param object row jQuery object for the attachment row.
- * @param object attach Attachment data object from phpbb.plupload.data
- * @param int index Attachment index from phpbb.plupload.ids
- * @return undefined
+ * @param {object} row jQuery object for the attachment row.
+ * @param {object} attach Attachment data object from phpbb.plupload.data
+ * @param {int} index Attachment index from phpbb.plupload.ids
*/
phpbb.plupload.updateHiddenData = function(row, attach, index) {
row.find('input[type="hidden"]').remove();
for (var key in attach) {
+ if (!attach.hasOwnProperty(key)) {
+ return;
+ }
+
var input = $('<input />')
.attr('type', 'hidden')
- .attr('name', 'attachment_data[' + index + '][' + key +']')
+ .attr('name', 'attachment_data[' + index + '][' + key + ']')
.attr('value', attach[key]);
$('textarea', row).after(input);
}
@@ -230,16 +221,14 @@ phpbb.plupload.updateHiddenData = function(row, attach, index) {
* responds with the updated attachment data list so that any future
* uploads can maintain state with the server
*
- * @param object row jQuery object for the attachment row.
- * @param int attachId Attachment id of the file to be removed.
- *
- * @return undefined
+ * @param {object} row jQuery object for the attachment row.
+ * @param {int} attachId Attachment id of the file to be removed.
*/
phpbb.plupload.deleteFile = function(row, attachId) {
// If there's no attach id, then the file hasn't been uploaded. Simply delete the row.
if (typeof attachId === 'undefined') {
- var file = uploader.getFile(row.attr('id'));
- uploader.removeFile(file);
+ var file = phpbb.plupload.uploader.getFile(row.attr('id'));
+ phpbb.plupload.uploader.removeFile(file);
row.slideUp(100, function() {
row.remove();
@@ -267,7 +256,7 @@ phpbb.plupload.deleteFile = function(row, attachId) {
// trigger_error() was called which likely means a permission error was encountered.
if (typeof response.title !== 'undefined') {
- uploader.trigger('Error', {message: response.message});
+ phpbb.plupload.uploader.trigger('Error', { message: response.message });
// We will have to assume that the deletion failed. So leave the file status as uploaded.
row.find('.file-status').toggleClass('file-uploaded');
@@ -278,21 +267,21 @@ phpbb.plupload.deleteFile = function(row, attachId) {
phpbb.plupload.handleMaxFilesReached();
if (row.attr('id')) {
- var file = uploader.getFile(row.attr('id'));
- uploader.removeFile(file);
+ var file = phpbb.plupload.uploader.getFile(row.attr('id'));
+ phpbb.plupload.uploader.removeFile(file);
}
row.slideUp(100, function() {
row.remove();
// Hide the file list if it's empty now.
phpbb.plupload.hideEmptyList();
});
- uploader.trigger('FilesRemoved');
+ phpbb.plupload.uploader.trigger('FilesRemoved');
};
$.ajax(phpbb.plupload.config.url, {
type: 'POST',
data: $.extend(fields, phpbb.plupload.getSerializedData()),
- headers: {'X-PHPBB-USING-PLUPLOAD': '1', 'X-Requested-With': 'XMLHttpRequest'}
+ headers: { 'X-PHPBB-USING-PLUPLOAD': '1', 'X-Requested-With': 'XMLHttpRequest' }
})
.always(always)
.done(done);
@@ -300,25 +289,21 @@ phpbb.plupload.deleteFile = function(row, attachId) {
/**
* Check the attachment list and hide its container if it's empty.
- *
- * @return undefined
*/
phpbb.plupload.hideEmptyList = function() {
if (!$('#file-list').children().length) {
$('#file-list-container').slideUp(100);
}
-}
+};
/**
- * Update the indices used in inline attachment bbcodes. This ensures that the bbcodes
- * correspond to the correct file after a file is added or removed. This should be called
- * before the phpbb.plupload,data and phpbb.plupload.ids arrays are updated, otherwise it will
- * not work correctly.
+ * Update the indices used in inline attachment bbcodes. This ensures that the
+ * bbcodes correspond to the correct file after a file is added or removed.
+ * This should be called before the phpbb.plupload,data and phpbb.plupload.ids
+ * arrays are updated, otherwise it will not work correctly.
*
- * @param string action The action that occurred -- either "addition" or "removal"
- * @param int index The index of the attachment from phpbb.plupload.ids that was affected.
- *
- * @return undefined
+ * @param {string} action The action that occurred -- either "addition" or "removal"
+ * @param {int} index The index of the attachment from phpbb.plupload.ids that was affected.
*/
phpbb.plupload.updateBbcode = function(action, index) {
var textarea = $('#message', phpbb.plupload.form),
@@ -330,64 +315,59 @@ phpbb.plupload.updateBbcode = function(action, index) {
return;
}
- // Private function used to replace the bbcode.
- var updateBbcode = function(match, fileName) {
- // Remove the bbcode if the file was removed.
- if (removal && index === i) {
- return '';
- }
- var newIndex = i + ((removal) ? -1 : 1);
- return '[attachment=' + newIndex +']' + fileName + '[/attachment]';
- };
-
- // Private function used to generate search regexp
- var searchRegexp = function(index) {
- return new RegExp('\\[attachment=' + index + '\\](.*?)\\[\\/attachment\\]', 'g');
+ function runUpdate(i) {
+ var regex = new RegExp('\\[attachment=' + i + '\\](.*?)\\[\\/attachment\\]', 'g');
+ text = text.replace(regex, function updateBbcode(_, fileName) {
+ // Remove the bbcode if the file was removed.
+ if (removal && index === i) {
+ return '';
+ }
+ var newIndex = i + ((removal) ? -1 : 1);
+ return '[attachment=' + newIndex + ']' + fileName + '[/attachment]';
+ });
}
- // The update order of the indices is based on the action taken to ensure that we don't corrupt
- // the bbcode index by updating it several times as we move through the loop.
- // Removal loop starts at the removed index and moves to the end of the array.
- // Addition loop starts at the end of the array and moves to the added index at 0.
- var searchLoop = function() {
- if (typeof i === 'undefined') {
- i = (removal) ? index : phpbb.plupload.ids.length - 1;
+
+ // Loop forwards when removing and backwards when adding ensures we don't
+ // corrupt the bbcode index.
+ var i;
+ if (removal) {
+ for (i = index; i < phpbb.plupload.ids.length; i++) {
+ runUpdate(i);
+ }
+ } else {
+ for (i = phpbb.plupload.ids.length - 1; i >= index; i--) {
+ runUpdate(i);
}
- return (removal) ? (i < phpbb.plupload.ids.length): (i >= index);
}
- var i;
- while (searchLoop()) {
- text = text.replace(searchRegexp(i), updateBbcode);
- (removal) ? i++ : i--;
- }
textarea.val(text);
};
/**
* Get Plupload file objects based on their upload status.
*
- * @param int status Plupload status - plupload.DONE, plupload.FAILED, plupload.QUEUED,
- * plupload.STARTED, plupload.STOPPED
+ * @param {int} status Plupload status - plupload.DONE, plupload.FAILED,
+ * plupload.QUEUED, plupload.STARTED, plupload.STOPPED
*
- * @return Returns an array of the Plupload file objects matching the status.
+ * @returns {Array} The Plupload file objects matching the status.
*/
phpbb.plupload.getFilesByStatus = function(status) {
var files = [];
- $.each(uploader.files, function(i, file) {
+ $.each(phpbb.plupload.uploader.files, function(i, file) {
if (file.status === status) {
files.push(file);
}
});
return files;
-}
+};
/**
* Check whether the user has reached the maximun number of files that he's allowed
* to upload. If so, disables the uploader and marks the queued files as failed. Otherwise
* makes sure that the uploader is enabled.
*
- * @return bool Returns true if the limit has been reached. False if otherwise.
+ * @returns {bool} True if the limit has been reached. False if otherwise.
*/
phpbb.plupload.handleMaxFilesReached = function() {
// If there is no limit, the user is an admin or moderator.
@@ -400,41 +380,36 @@ phpbb.plupload.handleMaxFilesReached = function() {
phpbb.plupload.markQueuedFailed(phpbb.plupload.lang.TOO_MANY_ATTACHMENTS);
// Disable the uploader.
phpbb.plupload.disableUploader();
- uploader.trigger('Error', {message: phpbb.plupload.lang.TOO_MANY_ATTACHMENTS});
+ phpbb.plupload.uploader.trigger('Error', { message: phpbb.plupload.lang.TOO_MANY_ATTACHMENTS });
return true;
- } else if(phpbb.plupload.maxFiles > phpbb.plupload.ids.length) {
+ } else if (phpbb.plupload.maxFiles > phpbb.plupload.ids.length) {
// Enable the uploader if the user is under the limit
phpbb.plupload.enableUploader();
}
return false;
-}
+};
/**
* Disable the uploader
- *
- * @return undefined
*/
phpbb.plupload.disableUploader = function() {
$('#add_files').addClass('disabled');
- uploader.disableBrowse();
-}
+ phpbb.plupload.uploader.disableBrowse();
+};
/**
* Enable the uploader
- *
- * @return undefined
*/
phpbb.plupload.enableUploader = function() {
$('#add_files').removeClass('disabled');
- uploader.disableBrowse(false);
-}
+ phpbb.plupload.uploader.disableBrowse(false);
+};
/**
* Mark all queued files as failed.
*
- * @param string error Error message to present to the user.
- * @return undefined
+ * @param {string} error Error message to present to the user.
*/
phpbb.plupload.markQueuedFailed = function(error) {
var files = phpbb.plupload.getFilesByStatus(plupload.QUEUED);
@@ -443,48 +418,49 @@ phpbb.plupload.markQueuedFailed = function(error) {
$('#' + file.id).find('.file-progress').hide();
phpbb.plupload.fileError(file, error);
});
-}
+};
/**
* Marks a file as failed and sets the error message for it.
*
- * @param object file Plupload file object that failed.
- * @param string error Error message to present to the user.
- * @return undefined
+ * @param {object} file Plupload file object that failed.
+ * @param {string} error Error message to present to the user.
*/
phpbb.plupload.fileError = function(file, error) {
file.status = plupload.FAILED;
file.error = error;
- $('#' + file.id).find('.file-status').addClass('file-error').attr({'data-error-title': phpbb.plupload.lang.ERROR, 'data-error-message': error});
-}
-
-
+ $('#' + file.id).find('.file-status')
+ .addClass('file-error')
+ .attr({
+ 'data-error-title': phpbb.plupload.lang.ERROR,
+ 'data-error-message': error
+ });
+};
/**
* Set up the Plupload object and get some basic data.
*/
-var uploader = new plupload.Uploader(phpbb.plupload.config);
+phpbb.plupload.uploader = new plupload.Uploader(phpbb.plupload.config);
phpbb.plupload.initialize();
-
-
+var $fileList = $('#file-list');
/**
* Insert inline attachment bbcode.
*/
- $('#file-list').on('click', '.file-inline-bbcode', function(e) {
+$fileList.on('click', '.file-inline-bbcode', function(e) {
var attachId = $(this).parents('.attach-row').attr('data-attach-id'),
index = phpbb.plupload.getIndex(attachId);
- attach_inline(index, phpbb.plupload.data[index].real_filename);
+ attachInline(index, phpbb.plupload.data[index].real_filename);
e.preventDefault();
});
/**
* Delete a file.
*/
-$('#file-list').on('click', '.file-delete', function(e) {
+$fileList.on('click', '.file-delete', function(e) {
var row = $(this).parents('.attach-row'),
attachId = row.attr('data-attach-id');
@@ -495,7 +471,7 @@ $('#file-list').on('click', '.file-delete', function(e) {
/**
* Display the error message for a particular file when the error icon is clicked.
*/
-$('#file-list').on('click', '.file-error', function(e) {
+$fileList.on('click', '.file-error', function(e) {
phpbb.alert($(this).attr('data-error-title'), $(this).attr('data-error-message'));
e.preventDefault();
});
@@ -503,7 +479,7 @@ $('#file-list').on('click', '.file-error', function(e) {
/**
* Fires when an error occurs.
*/
-uploader.bind('Error', function(up, error) {
+phpbb.plupload.uploader.bind('Error', function(up, error) {
error.file.name = plupload.xmlEncode(error.file.name);
// The error message that Plupload provides for these is vague, so we'll be more specific.
@@ -520,18 +496,15 @@ uploader.bind('Error', function(up, error) {
* send the real filename along with the chunk. This is necessary because
* for some reason the filename is set to 'blob' whenever a file is chunked
*
- * @param object up The plupload.Uploader object
- * @param object file The plupload.File object that is about to be
- * uploaded
- *
- * @return undefined
+ * @param {object} up The plupload.Uploader object
+ * @param {object} file The plupload.File object that is about to be uploaded
*/
-uploader.bind('BeforeUpload', function(up, file) {
+phpbb.plupload.uploader.bind('BeforeUpload', function(up, file) {
if (phpbb.plupload.handleMaxFilesReached()) {
return;
}
- phpbb.plupload.updateMultipartParams({'real_filename': file.name});
+ phpbb.plupload.updateMultipartParams({ real_filename: file.name });
});
/**
@@ -539,14 +512,12 @@ uploader.bind('BeforeUpload', function(up, file) {
* response from the server and checks for an error. If an error occurs it
* is reported to the user and the upload of this particular file is halted
*
- * @param object up The plupload.Uploader object
- * @param object file The plupload.File object whose chunk has just
+ * @param {object} up The plupload.Uploader object
+ * @param {object} file The plupload.File object whose chunk has just
* been uploaded
- * @param object response The response object from the server
- *
- * @return undefined
+ * @param {object} response The response object from the server
*/
-uploader.bind('ChunkUploaded', function(up, file, response) {
+phpbb.plupload.uploader.bind('ChunkUploaded', function(up, file, response) {
if (response.chunk >= response.chunks - 1) {
return;
}
@@ -567,7 +538,7 @@ uploader.bind('ChunkUploaded', function(up, file, response) {
// If trigger_error() was called, then a permission error likely occurred.
if (typeof json.title !== 'undefined') {
- json.error = {message: json.message};
+ json.error = { message: json.message };
}
if (json.error) {
@@ -584,10 +555,8 @@ uploader.bind('ChunkUploaded', function(up, file, response) {
/**
* Fires when files are added to the queue.
- *
- * @return undefined
*/
-uploader.bind('FilesAdded', function(up, files) {
+phpbb.plupload.uploader.bind('FilesAdded', function(up, files) {
// Prevent unnecessary requests to the server if the user already uploaded
// the maximum number of files allowed.
if (phpbb.plupload.handleMaxFilesReached()) {
@@ -595,13 +564,14 @@ uploader.bind('FilesAdded', function(up, files) {
}
// Switch the active tab if the style supports it
- if (typeof activateSubPanel == 'function') {
- activateSubPanel('attach-panel');
+ if (typeof activateSubPanel === 'function') {
+ activateSubPanel('attach-panel'); // jshint ignore: line
}
// Show the file list if there aren't any files currently.
- if (!$('#file-list-container').is(':visible')) {
- $('#file-list-container').show(100);
+ var $fileListContainer = $('#file-list-container');
+ if (!$fileListContainer.is(':visible')) {
+ $fileListContainer.show(100);
}
$.each(files, function(i, file) {
@@ -609,7 +579,7 @@ uploader.bind('FilesAdded', function(up, files) {
});
up.bind('UploadProgress', function(up, file) {
- $('#' + file.id + " .file-progress-bar").css('width', file.percent + '%');
+ $('.file-progress-bar', '#' + file.id).css('width', file.percent + '%');
$('#file-total-progress-bar').css('width', up.total.percent + '%');
});
@@ -627,14 +597,12 @@ uploader.bind('FilesAdded', function(up, files) {
* appends it to the next file upload so that the server can maintain state
* with regards to the attachments in a given post
*
- * @param object up The plupload.Uploader object
- * @param object file The plupload.File object that has just been
+ * @param {object} up The plupload.Uploader object
+ * @param {object} file The plupload.File object that has just been
* uploaded
- * @param string response The response string from the server
- *
- * @return undefined
+ * @param {string} response The response string from the server
*/
-uploader.bind('FileUploaded', function(up, file, response) {
+phpbb.plupload.uploader.bind('FileUploaded', function(up, file, response) {
var json = {},
row = $('#' + file.id),
error;
@@ -643,7 +611,7 @@ uploader.bind('FileUploaded', function(up, file, response) {
row.find('.file-progress').hide();
try {
- json = $.parseJSON(response.response);
+ json = JSON.parse(response.response);
} catch (e) {
error = 'Error parsing server response.';
}
@@ -651,7 +619,7 @@ uploader.bind('FileUploaded', function(up, file, response) {
// If trigger_error() was called, then a permission error likely occurred.
if (typeof json.title !== 'undefined') {
error = json.message;
- up.trigger('Error', {message: error});
+ up.trigger('Error', { message: error });
// The rest of the queue will fail.
phpbb.plupload.markQueuedFailed(error);
@@ -662,25 +630,19 @@ uploader.bind('FileUploaded', function(up, file, response) {
if (typeof error !== 'undefined') {
phpbb.plupload.fileError(file, error);
} else if (file.status === plupload.DONE) {
- file.attachment_data = json['data'][0];
+ file.attachment_data = json.data[0];
row.attr('data-attach-id', file.attachment_data.attach_id);
row.find('.file-inline-bbcode').show();
row.find('.file-status').addClass('file-uploaded');
- phpbb.plupload.update(json['data'], 'addition', 0, [json['download_url']]);
+ phpbb.plupload.update(json.data, 'addition', 0, [json.download_url]);
}
});
/**
- * Fires when the entire queue of files have been uploaded.
- *
- * @param object up The plupload.Uploader object
- * @param array files An array of plupload.File objects that have just
- * been uploaded as part of a queue
- *
- * @return undefined
+ * Fires when the entire queue of files have been uploaded.
*/
-uploader.bind('UploadComplete', function(up, files) {
+phpbb.plupload.uploader.bind('UploadComplete', function() {
// Hide the progress bar
setTimeout(function() {
$('#file-total-progress-bar').fadeOut(500, function() {
diff --git a/phpBB/composer.json b/phpBB/composer.json
index 69f0de8479..f2564de0f5 100644
--- a/phpBB/composer.json
+++ b/phpBB/composer.json
@@ -38,11 +38,11 @@
},
"require-dev": {
"fabpot/goutte": "1.0.*",
+ "phing/phing": "2.4.*",
"phpunit/dbunit": "1.3.*",
"phpunit/phpunit": "4.1.*",
- "phing/phing": "2.4.*",
"sami/sami": "1.*",
- "squizlabs/php_codesniffer": "1.*",
+ "squizlabs/php_codesniffer": "2.*",
"symfony/browser-kit": "2.3.*",
"symfony/css-selector": "2.3.*",
"symfony/debug": "2.3.*",
diff --git a/phpBB/composer.lock b/phpBB/composer.lock
index 07ae59f863..4a034bbdf8 100644
--- a/phpBB/composer.lock
+++ b/phpBB/composer.lock
@@ -1,9 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
- "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
+ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
],
- "hash": "d93446768ea0665b7c55c01890153a67",
+ "hash": "17b51553237b78392baf2ec78bfdfbc0",
"packages": [
{
"name": "lusitanian/oauth",
@@ -652,12 +653,12 @@
"version": "v1.13.2",
"source": {
"type": "git",
- "url": "https://github.com/fabpot/Twig.git",
+ "url": "https://github.com/twigphp/Twig.git",
"reference": "6d6a1009427d1f398c9d40904147bf9f723d5755"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fabpot/Twig/zipball/6d6a1009427d1f398c9d40904147bf9f723d5755",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/6d6a1009427d1f398c9d40904147bf9f723d5755",
"reference": "6d6a1009427d1f398c9d40904147bf9f723d5755",
"shasum": ""
},
@@ -682,14 +683,11 @@
"authors": [
{
"name": "Fabien Potencier",
- "email": "fabien@symfony.com",
- "homepage": "http://fabien.potencier.org",
- "role": "Lead Developer"
+ "email": "fabien@symfony.com"
},
{
"name": "Armin Ronacher",
- "email": "armin.ronacher@active-4.com",
- "role": "Project Founder"
+ "email": "armin.ronacher@active-4.com"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
@@ -1914,41 +1912,45 @@
},
{
"name": "squizlabs/php_codesniffer",
- "version": "1.5.2",
+ "version": "2.3.2",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
- "reference": "a76a39b317ce8106abe6264daa505e24e1731860"
+ "reference": "e96d8579fbed0c95ecf2a0501ec4f307a4aa6404"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/a76a39b317ce8106abe6264daa505e24e1731860",
- "reference": "a76a39b317ce8106abe6264daa505e24e1731860",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e96d8579fbed0c95ecf2a0501ec4f307a4aa6404",
+ "reference": "e96d8579fbed0c95ecf2a0501ec4f307a4aa6404",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
"php": ">=5.1.2"
},
- "suggest": {
- "phpunit/php-timer": "dev-master"
- },
"bin": [
- "scripts/phpcs"
+ "scripts/phpcs",
+ "scripts/phpcbf"
],
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
"autoload": {
"classmap": [
"CodeSniffer.php",
"CodeSniffer/CLI.php",
"CodeSniffer/Exception.php",
"CodeSniffer/File.php",
+ "CodeSniffer/Fixer.php",
"CodeSniffer/Report.php",
"CodeSniffer/Reporting.php",
"CodeSniffer/Sniff.php",
"CodeSniffer/Tokens.php",
"CodeSniffer/Reports/",
- "CodeSniffer/CommentParser/",
"CodeSniffer/Tokenizers/",
"CodeSniffer/DocGenerators/",
"CodeSniffer/Standards/AbstractPatternSniff.php",
@@ -1974,13 +1976,13 @@
"role": "lead"
}
],
- "description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "http://www.squizlabs.com/php-codesniffer",
"keywords": [
"phpcs",
"standards"
],
- "time": "2014-02-04 23:49:58"
+ "time": "2015-04-28 23:28:20"
},
{
"name": "symfony/browser-kit",
@@ -2236,17 +2238,13 @@
"time": "2014-10-01 05:38:33"
}
],
- "aliases": [
-
- ],
+ "aliases": [],
"minimum-stability": "stable",
- "stability-flags": [
-
- ],
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
"platform": {
"php": ">=5.3.3"
},
- "platform-dev": [
-
- ]
+ "platform-dev": []
}
diff --git a/phpBB/develop/export_events_for_wiki.php b/phpBB/develop/export_events_for_wiki.php
index 2096e9c858..be16e5e7cd 100644
--- a/phpBB/develop/export_events_for_wiki.php
+++ b/phpBB/develop/export_events_for_wiki.php
@@ -18,15 +18,19 @@ if (php_sapi_name() != 'cli')
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path = __DIR__ . '/../';
+define('IN_PHPBB', true);
function usage()
{
- echo "Usage: export_events_for_wiki.php COMMAND [EXTENSION]\n";
+ echo "Usage: export_events_for_wiki.php COMMAND [VERSION] [EXTENSION]\n";
echo "\n";
echo "COMMAND:\n";
echo " all:\n";
echo " Generate the complete wikipage for https://wiki.phpbb.com/Event_List\n";
echo "\n";
+ echo " diff:\n";
+ echo " Generate the Event Diff for the release highlights\n";
+ echo "\n";
echo " php:\n";
echo " Generate the PHP event section of Event_List\n";
echo "\n";
@@ -36,6 +40,9 @@ function usage()
echo " styles:\n";
echo " Generate the Styles Template event section of Event_List\n";
echo "\n";
+ echo "VERSION (diff only):\n";
+ echo " Filter events (minimum version)\n";
+ echo "\n";
echo "EXTENSION (Optional):\n";
echo " If not given, only core events will be exported.\n";
echo " Otherwise only events from the extension will be exported.\n";
@@ -55,20 +62,32 @@ validate_argument_count($argc, 1);
$action = $argv[1];
$extension = isset($argv[2]) ? $argv[2] : null;
+$min_version = null;
require __DIR__ . '/../phpbb/event/php_exporter.' . $phpEx;
require __DIR__ . '/../phpbb/event/md_exporter.' . $phpEx;
+require __DIR__ . '/../includes/functions.' . $phpEx;
require __DIR__ . '/../phpbb/event/recursive_event_filter_iterator.' . $phpEx;
require __DIR__ . '/../phpbb/recursive_dot_prefix_filter_iterator.' . $phpEx;
switch ($action)
{
+
+ case 'diff':
+ echo '== Event changes ==' . "\n";
+ $min_version = $extension;
+ $extension = isset($argv[3]) ? $argv[3] : null;
+
case 'all':
- echo '__FORCETOC__' . "\n";
+ if ($action === 'all')
+ {
+ echo '__FORCETOC__' . "\n";
+ }
+
case 'php':
- $exporter = new \phpbb\event\php_exporter($phpbb_root_path, $extension);
+ $exporter = new \phpbb\event\php_exporter($phpbb_root_path, $extension, $min_version);
$exporter->crawl_phpbb_directory_php();
- echo $exporter->export_events_for_wiki();
+ echo $exporter->export_events_for_wiki($action);
if ($action === 'php')
{
@@ -78,9 +97,16 @@ switch ($action)
// no break;
case 'styles':
- $exporter = new \phpbb\event\md_exporter($phpbb_root_path, $extension);
- $exporter->crawl_phpbb_directory_styles('docs/events.md');
- echo $exporter->export_events_for_wiki();
+ $exporter = new \phpbb\event\md_exporter($phpbb_root_path, $extension, $min_version);
+ if ($min_version && $action === 'diff')
+ {
+ $exporter->crawl_eventsmd('docs/events.md', 'styles');
+ }
+ else
+ {
+ $exporter->crawl_phpbb_directory_styles('docs/events.md');
+ }
+ echo $exporter->export_events_for_wiki($action);
if ($action === 'styles')
{
@@ -90,9 +116,16 @@ switch ($action)
// no break;
case 'adm':
- $exporter = new \phpbb\event\md_exporter($phpbb_root_path, $extension);
- $exporter->crawl_phpbb_directory_adm('docs/events.md');
- echo $exporter->export_events_for_wiki();
+ $exporter = new \phpbb\event\md_exporter($phpbb_root_path, $extension, $min_version);
+ if ($min_version && $action === 'diff')
+ {
+ $exporter->crawl_eventsmd('docs/events.md', 'adm');
+ }
+ else
+ {
+ $exporter->crawl_phpbb_directory_adm('docs/events.md');
+ }
+ echo $exporter->export_events_for_wiki($action);
if ($action === 'all')
{
diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php
index 3a013a2162..07c4024b2f 100644
--- a/phpBB/develop/search_fill.php
+++ b/phpBB/develop/search_fill.php
@@ -40,7 +40,7 @@ if (!class_exists($search_type))
}
$error = false;
-$search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+$search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
if ($error)
{
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 9710014b56..88df39a6d5 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -49,7 +49,8 @@
<ol>
<li><a href="#changelog">Changelog</a>
<ul>
- <li><a href="#v312">Changes since 3.1.3-RC1</a></li>
+ <li><a href="#v313">Changes since 3.1.3</a></li>
+ <li><a href="#v313rc1">Changes since 3.1.3-RC1</a></li>
<li><a href="#v312">Changes since 3.1.2</a></li>
<li><a href="#v311">Changes since 3.1.1</a></li>
<li><a href="#v310">Changes since 3.1.0</a></li>
@@ -67,6 +68,7 @@
<li><a href="#v310a2">Changes since 3.1.0-a2</a></li>
<li><a href="#v310a1">Changes since 3.1.0-a1</a></li>
<li><a href="#v30x">Changes since 3.0.x</a></li>
+ <li><a href="#v3013-PL1">Changes since 3.0.13-PL1</a></li>
<li><a href="#v3013">Changes since 3.0.13</a></li>
<li><a href="#v3012">Changes since 3.0.12</a></li>
<li><a href="#v3011">Changes since 3.0.11</a></li>
@@ -109,6 +111,124 @@
<div class="content">
+ <a name="v313"></a><h3>Changes since 3.1.3</h3>
+
+ <h4>Security</h4>
+ <ul>
+ <li>[SECURITY-180] - An insufficient check allowed users of the Google Chrome browser to be redirected to external domains (e.g. on login)</li>
+ </ul>
+ <h4>Bug</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8050">PHPBB3-8050</a>] - Avatar &amp; Long PM recipients list break out of template</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8250">PHPBB3-8250</a>] - Forum selections in MCP queue not working</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8494">PHPBB3-8494</a>] - Cannot install two boards on the same postgresql database</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11424">PHPBB3-11424</a>] - Quick-Mod Tools race condition results in NO_MODE</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12368">PHPBB3-12368</a>] - Updating database fails in upgrade from 3.0 when trying twice without purging the cache</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13348">PHPBB3-13348</a>] - sql_freeresult() should be called in feed base class</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13414">PHPBB3-13414</a>] - download/file.php 304 Not Modified bug</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13433">PHPBB3-13433</a>] - A dot in email address leads to unwanted extraneous dot</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13463">PHPBB3-13463</a>] - Mark read icon displays on wrong side in RTL</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13469">PHPBB3-13469</a>] - Soft delete fails with error message</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13472">PHPBB3-13472</a>] - Notification for admin activation of user doesn't get pruned after the user is deleted</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13477">PHPBB3-13477</a>] - File caching of extensions' version check file doesn't work</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13493">PHPBB3-13493</a>] - $helper-&gt;route gives wrong path for guests with trailing slashes and mod_rewrite disabled</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13522">PHPBB3-13522</a>] - Q&amp;A Captcha ACP, admins can add blank answers</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13538">PHPBB3-13538</a>] - Add tests for pagination in nested loops</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13542">PHPBB3-13542</a>] - Add $error to core UCP event for better validating of new UCP options</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13550">PHPBB3-13550</a>] - Invalid JSON response returned when plupload dir is not writable</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13551">PHPBB3-13551</a>] - Authentication method- LDAP- entered value 'ldap base dn' does not display</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13555">PHPBB3-13555</a>] - Poll options preview rendered incorrectly by &lt;br /&gt; collision</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13563">PHPBB3-13563</a>] - No Private Message button shown in memberlist for subsilver2</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13568">PHPBB3-13568</a>] - Imagick path validated as relative path although ACP asks for absolute path</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13569">PHPBB3-13569</a>] - Use sql_freeresult for $result assignments and remove unneeded $result assignments</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13570">PHPBB3-13570</a>] - Mysqli extension supports persistent connection since PHP 5.3.0</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13577">PHPBB3-13577</a>] - Skip tests requiring fileinfo if fileinfo is not enabled</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13586">PHPBB3-13586</a>] - Allow '0' as username with Jabber notifications</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13587">PHPBB3-13587</a>] - SQL syntax errors in get_prune_users()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13588">PHPBB3-13588</a>] - Information message for disabled fsockopen() is not displayed correctly</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13590">PHPBB3-13590</a>] - Remember me login keys should be centered</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13597">PHPBB3-13597</a>] - Modify variable-variable syntax to be compatible with PHP7</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13612">PHPBB3-13612</a>] - Functional test of extension fails if ext requires page refresh</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13615">PHPBB3-13615</a>] - Avatar Gallery shows categories but no images in subsilver2</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13617">PHPBB3-13617</a>] - Bot session continuation with invalid f= query paramter causes SQL error</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13618">PHPBB3-13618</a>] - Small grammatical typo in the English FAQ regarding COPPA</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13631">PHPBB3-13631</a>] - Fix variable name in core.phpbb_content_visibility_get_global_visibility_before event</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13639">PHPBB3-13639</a>] - Unused class icon-search-advanced references nonexistent image</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13644">PHPBB3-13644</a>] - Type hint dispatcher_interface instead of dispatcher</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13649">PHPBB3-13649</a>] - Subforum tooltip always displays &quot;no unread posts&quot; on viewforum.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13655">PHPBB3-13655</a>] - $phpbb_dispatcher undefined in phpbb_mcp_sorting()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13657">PHPBB3-13657</a>] - Start testing against PHP7</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13666">PHPBB3-13666</a>] - data-clicked attribute is not always removed on ajax form submissions</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13667">PHPBB3-13667</a>] - Big buttons are incorrectly aligned in Chrome on Windows</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13670">PHPBB3-13670</a>] - Fix fatal function name must be a string in functional tests</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13698">PHPBB3-13698</a>] - Incorrect password message shows unparsed &quot;Board Administrator&quot;-link</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13702">PHPBB3-13702</a>] - Page is zoomed in by default on iOS devices in landscape mode</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13703">PHPBB3-13703</a>] - Uploaded avatars are not loading correctly when passing through the events</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13719">PHPBB3-13719</a>] - Remove superfluous $search_options in acp_search.php </li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13721">PHPBB3-13721</a>] - URL Rewriting doesn't work on IIS7</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13723">PHPBB3-13723</a>] - Update docs/AUTHORS for 3.1.4-RC1</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13726">PHPBB3-13726</a>] - Responsive breadcrumbs JavaScript incorrectly calculates width of hidden items</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13727">PHPBB3-13727</a>] - Responsive breadcrumbs JavaScript doesn't reset wrap- classes when resizing</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13732">PHPBB3-13732</a>] - Update composer for PHP7 compatibility</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13736">PHPBB3-13736</a>] - Replace colons with colon lang keys in Contact us page</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13738">PHPBB3-13738</a>] - Sami still refers to develop-* branches</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13741">PHPBB3-13741</a>] - Remove outdated comments in CSS files</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13742">PHPBB3-13742</a>] - Local avatar driver is not generating correct urls on index</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13743">PHPBB3-13743</a>] - Missing global vars $phpbb_root_path and $phpEx in message_parser.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13747">PHPBB3-13747</a>] - Fix test_validate_path_linux method</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13749">PHPBB3-13749</a>] - Add missing slash to base uri in helper route tests</li>
+ </ul>
+ <h4>Improvement</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13313">PHPBB3-13313</a>] - Add a core php event to the mass email form</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13467">PHPBB3-13467</a>] - Add a CONTRIBUTING file to the project on Github</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13510">PHPBB3-13510</a>] - Add template event before/after the pagination on viewtopic</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13512">PHPBB3-13512</a>] - Add template events to viewtopic_body.html before/after the post details</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13518">PHPBB3-13518</a>] - Add core event to markread() in functions.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13532">PHPBB3-13532</a>] - Add core event to get_unread_topics() in functions.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13533">PHPBB3-13533</a>] - Add template events to the header of search_results.html</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13535">PHPBB3-13535</a>] - Add ucp_profile.php core event to allow modifying account settings on editing</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13536">PHPBB3-13536</a>] - Add UCP/ACP core events to allow modifying user profile data on editing</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13537">PHPBB3-13537</a>] - Add core events on mcp_queue for approval and disapproval</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13540">PHPBB3-13540</a>] - Add events to the topic review while posting and moderating posts</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13578">PHPBB3-13578</a>] - Add ucp_register.php core event</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13591">PHPBB3-13591</a>] - Add functions.php core event to the function obtain_users_online_string()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13595">PHPBB3-13595</a>] - Remove unused instances of the bbcode class</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13596">PHPBB3-13596</a>] - Add display_forums() core event to allow modifying forums list data</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13600">PHPBB3-13600</a>] - Add core event to allow extensions to create a custom help page</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13602">PHPBB3-13602</a>] - Add template event overall_header_navbar_before</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13628">PHPBB3-13628</a>] - Add template events into ucp profile html files</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13635">PHPBB3-13635</a>] - Add sql_ary to UCP profile event</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13637">PHPBB3-13637</a>] - Add php event for modifying the data when composing a PM</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13643">PHPBB3-13643</a>] - kernel_terminate_subscriber should have a very low priority</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13650">PHPBB3-13650</a>] - New core event for UCP profile mode</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13658">PHPBB3-13658</a>] - [Event] - Before and after deletion of topics</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13675">PHPBB3-13675</a>] - Add validate to acp_profile event and add template events</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13679">PHPBB3-13679</a>] - Add template event overall_header_searchbox_before</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13701">PHPBB3-13701</a>] - New posting_pm_layout.html template events to wrap &quot;include posting_pm_header.html&quot;</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13710">PHPBB3-13710</a>] - Add template events around smilies display</li>
+ </ul>
+ <h4>New Feature</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13336">PHPBB3-13336</a>] - New core events for user activation</li>
+ </ul>
+ <h4>Sub-task</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13142">PHPBB3-13142</a>] - [Event] - Before query to list unapproved and deleted posts</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13592">PHPBB3-13592</a>] - Add core event to allow changing get_visibility_sql's result</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13621">PHPBB3-13621</a>] - Fix event phpbb_content_visibility_get_forums_visibility_before to get where_sql working as specified</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13625">PHPBB3-13625</a>] - Add more variables to core.viewforum_get_topic_data</li>
+ </ul>
+ <h4>Task</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9457">PHPBB3-9457</a>] - [Accessibility] - Add WAI-ARIA landmarks to the Prosilver template files</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12599">PHPBB3-12599</a>] - Update documentation styling</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13572">PHPBB3-13572</a>] - Upgrade composer to 1.0.0-alpha9</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13626">PHPBB3-13626</a>] - Add branch aliases</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13634">PHPBB3-13634</a>] - Update README to show new branch names</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13640">PHPBB3-13640</a>] - Rearrange order of color css rules</li>
+ </ul>
+
<a name="v313rc1"></a><h3>Changes since 3.1.3-RC1</h3>
<h4>Bug</h4>
@@ -2213,6 +2333,35 @@
<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="v3013-PL1"></a><h3>Changes since 3.0.13-PL1</h3>
+
+<h4>Security</h4>
+<ul>
+<li>[SECURITY-180] - An insufficient check allowed users of the Google Chrome browser to be redirected to external domains (e.g. on login)</li>
+</ul>
+<h4>Bug</h4>
+<ul>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13348">PHPBB3-13348</a>] - sql_freeresult() should be called in feed base class</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13414">PHPBB3-13414</a>] - download/file.php sends Content-Length header even when issuing 304 Not Modified</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13555">PHPBB3-13555</a>] - Poll options preview rendered incorrectly by &lt;br /&gt; collision</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13568">PHPBB3-13568</a>] - Imagick path validated as relative path although ACP asks for absolute path</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13617">PHPBB3-13617</a>] - Bot session continuation with invalid f= query parameter causes SQL error</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13738">PHPBB3-13738</a>] - Sami still refers to develop-* branches</li>
+</ul>
+<h4>Improvement</h4>
+<ul>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12089">PHPBB3-12089</a>] - Make HTTP status code assertion failure messages more informative</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13765">PHPBB3-13765</a>] - Verify that SERVER_PROTOCOL has the expected format</li>
+</ul>
+<h4>Task</h4>
+<ul>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11539">PHPBB3-11539</a>] - Add unit tests for several functions in functions.php</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13572">PHPBB3-13572</a>] - Upgrade composer to 1.0.0-alpha9</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13599">PHPBB3-13599</a>] - Remove PHP 5.2 Travis environment</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13634">PHPBB3-13634</a>] - Update README to show new branch names</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13723">PHPBB3-13723</a>] - Update docs/AUTHORS for 3.0.14-RC1 / 3.1.4-RC1</li>
+</ul>
+
<a name="v3013"></a><h3>Changes since 3.0.13</h3>
<h4>Bug</h4>
diff --git a/phpBB/docs/CREDITS.txt b/phpBB/docs/CREDITS.txt
index 5c17787495..e3f2b325e8 100644
--- a/phpBB/docs/CREDITS.txt
+++ b/phpBB/docs/CREDITS.txt
@@ -24,9 +24,10 @@ phpBB Lead Developer: naderman (Nils Adermann)
phpBB Developers: bantu (Andreas Fischer)
dhruv.goel92 (Dhruv Goel)
+ Elsensee (Oliver Schramm)
marc1706 (Marc Alexander)
nickvergessen (Joas Schilling)
- nicofuma (Tristan Darricau)
+ Nicofuma (Tristan Darricau)
prototech (Cesar Gallegos)
For a list of phpBB Team members, please see:
diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html
index 4050636b38..d1c0fe1438 100644
--- a/phpBB/docs/INSTALL.html
+++ b/phpBB/docs/INSTALL.html
@@ -303,7 +303,7 @@
<p>This update method is the recommended method for updating. This package detects changed files automatically and merges in changes if needed.</p>
- <p>The automatic update package will update the board from a given version to the latest version. A number of automatic update files are available, and you should choose the one that corresponds to the version of the board that you are currently running. For example, if your current version is <strong>3.0.12</strong>, you need the <code>phpBB-3.0.12_to_3.0.13.zip/tar.bz2</code> file.</p>
+ <p>The automatic update package will update the board from a given version to the latest version. A number of automatic update files are available, and you should choose the one that corresponds to the version of the board that you are currently running. For example, if your current version is <strong>3.0.13</strong>, you need the <code>phpBB-3.0.13_to_3.0.14.zip/tar.bz2</code> file.</p>
<p>To perform the update, either follow the instructions from the <strong>Administration Control Panel-&gt;System</strong> Tab - this should point out that you are running an outdated version and will guide you through the update - or follow the instructions listed below.</p>
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index f0deea685d..5350ebbc6b 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -293,6 +293,20 @@ forumlist_body_category_header_before
* Since: 3.1.0-a4
* Purpose: Add content before the header of the category on the forum list.
+forumlist_body_category_header_row_append
+===
+* Locations:
+ + styles/prosilver/template/forumlist_body.html
+* Since: 3.1.5-RC1
+* Purpose: Add content after the header row of the category on the forum list.
+
+forumlist_body_category_header_row_prepend
+===
+* Locations:
+ + styles/prosilver/template/forumlist_body.html
+* Since: 3.1.5-RC1
+* Purpose: Add content before the header row of the category on the forum list.
+
forumlist_body_forum_row_after
===
* Locations:
@@ -517,6 +531,14 @@ mcp_front_latest_unapproved_before
* Since: 3.1.3-RC1
* Purpose: Add content before latest unapproved posts list
+mcp_post_additional_options
+===
+* Locations:
+ + styles/prosilver/template/mcp_post.html
+ + styles/subsilver2/template/mcp_post.html
+* Since: 3.1.5-RC1
+* Purpose: Add content within the list of post moderation actions
+
memberlist_body_username_append
===
* Locations:
@@ -840,6 +862,14 @@ overall_header_head_append
* Since: 3.1.0-a1
* Purpose: Add asset calls directly before the `</head>` tag
+overall_header_navbar_before
+===
+* Locations:
+ + styles/prosilver/template/overall_header.html
+ + styles/subsilver2/template/overall_header.html
+* Since: 3.1.4-RC1
+* Purpose: Add content before the navigation bar
+
overall_header_navigation_append
===
* Locations:
@@ -880,6 +910,13 @@ overall_header_page_body_before
* Since: 3.1.0-b3
* Purpose: Add content after the page-header, but before the page-body
+overall_header_searchbox_before
+===
+* Locations:
+ + styles/prosilver/template/overall_header.html
+* Since: 3.1.4-RC1
+* Purpose: Add content before the search box in the header
+
overall_header_stylesheets_after
===
* Locations:
@@ -889,6 +926,14 @@ overall_header_stylesheets_after
* Purpose: Add asset calls after stylesheets within the `</head>` tag.
Note that INCLUDECSS will not work with this event.
+posting_editor_bbcode_status_after
+===
+* Locations:
+ + styles/prosilver/template/posting_editor.html
+ + styles/subsilver2/template/posting_body.html
+* Since: 3.1.4-RC1
+* Purpose: Add content after bbcode status
+
posting_editor_buttons_after
===
* Locations:
@@ -937,6 +982,22 @@ posting_editor_options_prepend
* Since: 3.1.0-a1
* Purpose: Add posting options on the posting screen
+posting_editor_smilies_after
+===
+* Locations:
+ + styles/prosilver/template/posting_editor.html
+ + styles/subsilver2/template/posting_body.html
+* Since: 3.1.4-RC1
+* Purpose: Add content after smilies
+
+posting_editor_smilies_before
+===
+* Locations:
+ + styles/prosilver/template/posting_editor.html
+ + styles/subsilver2/template/posting_body.html
+* Since: 3.1.4-RC1
+* Purpose: Add content before the smilies
+
posting_editor_subject_after
===
* Locations:
@@ -969,6 +1030,28 @@ posting_pm_header_find_username_before
* Since: 3.1.0-RC4
* Purpose: Add content before the find username link on composing pm
+posting_pm_layout_include_pm_header_after
+===
+* Locations:
+ + styles/prosilver/template/posting_pm_layout.html
+* Since: 3.1.4-RC1
+* Purpose: Add content after the include of posting_pm_header.html
+
+posting_pm_layout_include_pm_header_before
+===
+* Locations:
+ + styles/prosilver/template/posting_pm_layout.html
+* Since: 3.1.4-RC1
+* Purpose: Add content before the include of posting_pm_header.html
+
+posting_poll_body_options_after
+===
+* Locations:
+ + styles/prosilver/template/posting_poll_body.html
+ + styles/subsilver2/template/posting_poll_body.html
+* Since: 3.1.4-RC1
+* Purpose: Add content after the poll options on creating a poll
+
quickreply_editor_panel_after
===
* Locations:
@@ -1001,6 +1084,14 @@ quickreply_editor_message_before
* Since: 3.1.0-a4
* Purpose: Add content before the quick reply textbox
+search_body_form_before
+===
+* Locations:
+ + styles/prosilver/template/search_body.html
+ + styles/subsilver2/template/search_body.html
+* Since: 3.1.5-RC1
+* Purpose: Add content before the search form
+
search_results_header_after
===
* Locations:
@@ -1448,6 +1539,22 @@ viewforum_forum_name_prepend
* Since: 3.1.0-b3
* Purpose: Add content directly before the forum name link on the View forum screen
+viewforum_forum_title_after
+===
+* Locations:
+ + styles/prosilver/template/viewforum_body.html
+ + styles/subsilver2/template/viewforum_body.html
+* Since: 3.1.5-RC1
+* Purpose: Add content directly after the forum title on the View forum screen
+
+viewforum_forum_title_before
+===
+* Locations:
+ + styles/prosilver/template/viewforum_body.html
+ + styles/subsilver2/template/viewforum_body.html
+* Since: 3.1.5-RC1
+* Purpose: Add content directly before the forum title on the View forum screen
+
viewtopic_print_head_append
===
* Locations:
@@ -1574,6 +1681,22 @@ viewtopic_body_post_buttons_before
* Purpose: Add post button to posts (next to edit, quote etc), at the start of
the list.
+viewtopic_body_post_buttons_list_after
+===
+* Locations:
+ + styles/prosilver/template/viewtopic_body.html
+* Since: 3.1.5-RC1
+* Purpose: Add post button custom list to posts (next to edit, quote etc),
+after the original list.
+
+viewtopic_body_post_buttons_list_before
+===
+* Locations:
+ + styles/prosilver/template/viewtopic_body.html
+* Since: 3.1.5-RC1
+* Purpose: Add post button custom list to posts (next to edit, quote etc),
+before the original list.
+
viewtopic_body_postrow_custom_fields_after
===
* Locations:
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 2873b48fa4..67fba1094d 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -153,7 +153,7 @@ class acp_attachments
'img_create_thumbnail' => array('lang' => 'CREATE_THUMBNAIL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'img_max_thumb_width' => array('lang' => 'MAX_THUMB_WIDTH', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
- 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'path', 'type' => 'text:20:200', 'explain' => true, 'append' => '&nbsp;&nbsp;<span>[ <a href="' . $this->u_action . '&amp;action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'),
+ 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'absolute_path', 'type' => 'text:20:200', 'explain' => true, 'append' => '&nbsp;&nbsp;<span>[ <a href="' . $this->u_action . '&amp;action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'),
'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
'img_link' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
)
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 63e2647f02..4a1c74fd77 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -500,7 +500,7 @@ class acp_board
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
- foreach ($display_vars['vars'] as $config_name => $null)
+ foreach ($display_vars['vars'] as $config_name => $data)
{
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
{
@@ -514,7 +514,8 @@ class acp_board
if ($config_name == 'guest_style')
{
- if (isset($cfg_array[$config_name])) {
+ if (isset($cfg_array[$config_name]))
+ {
$this->guest_style_set($cfg_array[$config_name]);
}
continue;
@@ -531,6 +532,13 @@ class acp_board
if ($submit)
{
+ if (strpos($data['type'], 'password') === 0 && $config_value === '********')
+ {
+ // Do not update password fields if the content is ********,
+ // because that is the password replacement we use to not
+ // send the password to the output
+ continue;
+ }
set_config($config_name, $config_value);
if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable']))
@@ -559,6 +567,7 @@ class acp_board
$old_auth_config = array();
foreach ($auth_providers as $provider)
{
+ /** @var \phpbb\auth\provider\provider_interface $provider */
if ($fields = $provider->acp())
{
// Check if we need to create config fields for this plugin and save config when submit was pressed
@@ -574,6 +583,14 @@ class acp_board
continue;
}
+ if (substr($field, -9) === '_password' && $cfg_array[$field] === '********')
+ {
+ // Do not update password fields if the content is ********,
+ // because that is the password replacement we use to not
+ // send the password to the output
+ continue;
+ }
+
$old_auth_config[$field] = $this->new_config[$field];
$config_value = $cfg_array[$field];
$this->new_config[$field] = $config_value;
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 0c52f82459..c5aebf011d 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -1173,6 +1173,7 @@ class postgres_extractor extends base_extractor
$this->flush($sql_data . ";\n");
}
}
+ $db->sql_freeresult($result);
$sql_data = '-- Table: ' . $table_name . "\n";
$sql_data .= "DROP TABLE $table_name;\n";
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index 89fdc8b863..0c9bc0deab 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -174,11 +174,6 @@ class acp_extensions
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);
- }
-
try
{
while ($phpbb_extension_manager->enable_step($ext_name))
diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php
index 8d2e9d41a3..284543acd3 100644
--- a/phpBB/includes/acp/acp_jabber.php
+++ b/phpBB/includes/acp/acp_jabber.php
@@ -107,7 +107,10 @@ class acp_jabber
set_config('jab_host', $jab_host);
set_config('jab_port', $jab_port);
set_config('jab_username', $jab_username);
- set_config('jab_password', $jab_password);
+ if ($jab_password !== '********')
+ {
+ set_config('jab_password', $jab_password);
+ }
set_config('jab_package_size', $jab_package_size);
set_config('jab_use_ssl', $jab_use_ssl);
@@ -122,7 +125,7 @@ class acp_jabber
'JAB_HOST' => $jab_host,
'JAB_PORT' => ($jab_port) ? $jab_port : '',
'JAB_USERNAME' => $jab_username,
- 'JAB_PASSWORD' => $jab_password,
+ 'JAB_PASSWORD' => $jab_password !== '' ? '********' : '',
'JAB_PACKAGE_SIZE' => $jab_package_size,
'JAB_USE_SSL' => $jab_use_ssl,
'S_CAN_USE_SSL' => jabber::can_use_ssl(),
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 3d8991fb37..f6d728ffed 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -632,7 +632,7 @@ class acp_main
{
$error = false;
$search_type = $config['search_type'];
- $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+ $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
if (!$search->index_created())
{
diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php
index 6eb213fd7a..c68f26fc13 100644
--- a/phpBB/includes/acp/acp_prune.php
+++ b/phpBB/includes/acp/acp_prune.php
@@ -507,7 +507,7 @@ class acp_prune
AND ug.user_id <> ' . ANONYMOUS . '
AND u.user_type <> ' . USER_FOUNDER . '
AND ug.user_pending = 0 ' .
- ((!empty($user_ids)) ? ' AND ' . $db->sql_in_set('ug.user_id', $user_ids) : '') . '
+ (!empty($user_ids) ? ' AND ' . $db->sql_in_set('ug.user_id', $user_ids) : '') . '
AND u.user_id = ug.user_id';
$result = $db->sql_query($sql);
@@ -533,7 +533,7 @@ class acp_prune
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE u.user_id <> ' . ANONYMOUS . '
AND u.user_type <> ' . USER_FOUNDER .
- ((!empty($user_ids)) ? ' AND ' . $db->sql_in_set('p.poster_id', $user_ids) : '') . '
+ (!empty($user_ids) ? ' AND ' . $db->sql_in_set('p.poster_id', $user_ids) : '') . '
AND ' . $db->sql_in_set('p.post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . '
AND u.user_id = p.poster_id
GROUP BY p.poster_id
diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php
index 37b890c777..abb8301507 100644
--- a/phpBB/includes/acp/acp_search.php
+++ b/phpBB/includes/acp/acp_search.php
@@ -449,7 +449,6 @@ class acp_search
$search = null;
$error = false;
- $search_options = '';
foreach ($search_types as $type)
{
if ($this->init_search($type, $search, $error) || !method_exists($search, 'index_created'))
@@ -608,7 +607,7 @@ class acp_search
}
$error = false;
- $search = new $type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+ $search = new $type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
return $error;
}
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 5f6dcde448..86390c0901 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -182,6 +182,8 @@ class bbcode
$db->sql_freeresult($result);
}
+ // To perform custom second pass in extension, use $this->bbcode_second_pass_by_extension()
+ // method which accepts variable number of parameters
foreach ($bbcode_ids as $bbcode_id)
{
switch ($bbcode_id)
@@ -613,4 +615,36 @@ class bbcode
return $code;
}
+
+ /**
+ * Function to perform custom bbcode second pass by extensions
+ * can be used to assign bbcode pattern replacement
+ * Example: '#\[list=([^\[]+):$uid\]#e' => "\$this->bbcode_second_pass_by_extension('\$1')"
+ *
+ * Accepts variable number of parameters
+ *
+ * @return mixed Second pass result
+ */
+ function bbcode_second_pass_by_extension()
+ {
+ global $phpbb_dispatcher;
+
+ $return = false;
+ $params_array = func_get_args();
+
+ /**
+ * Event to perform bbcode second pass with
+ * the custom validating methods provided by extensions
+ *
+ * @event core.bbcode_second_pass_by_extension
+ * @var array params_array Array with the function parameters
+ * @var mixed return Second pass result to return
+ *
+ * @since 3.1.5-RC1
+ */
+ $vars = array('params_array', 'return');
+ extract($phpbb_dispatcher->trigger_event('core.bbcode_second_pass_by_extension', compact($vars)));
+
+ return $return;
+ }
}
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 321a87b4b0..c53d976615 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.4-dev');
+define('PHPBB_VERSION', '3.1.5-dev');
// QA-related
// define('PHPBB_QA', 1);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index acb4690a48..705222d66b 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1159,7 +1159,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
/**
* This event is used for performing actions directly before marking forums,
* topics or posts as read.
- *
+ *
* It is also possible to prevent the marking. For that, the $should_markread parameter
* should be set to FALSE.
*
@@ -2309,7 +2309,7 @@ function redirect($url, $return = false, $disable_cd_check = false)
// Attention: only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work)
if (!$disable_cd_check && $url_parts['host'] !== $user->host)
{
- $url = generate_board_url();
+ trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
}
}
else if ($url[0] == '/')
@@ -2347,7 +2347,7 @@ function redirect($url, $return = false, $disable_cd_check = false)
// Clean URL and check if we go outside the forum directory
$url = $phpbb_path_helper->clean_url($url);
- if (!$disable_cd_check && strpos($url, generate_board_url(true)) === false)
+ if (!$disable_cd_check && strpos($url, generate_board_url(true) . '/') !== 0)
{
trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
}
@@ -2389,7 +2389,7 @@ function redirect($url, $return = false, $disable_cd_check = false)
}
// Redirect via an HTML form for PITA webservers
- if (@preg_match('#Microsoft|WebSTAR|Xitami#', getenv('SERVER_SOFTWARE')))
+ if (@preg_match('#WebSTAR|Xitami#', getenv('SERVER_SOFTWARE')))
{
header('Refresh: 0; URL=' . $url);
@@ -2544,13 +2544,19 @@ function phpbb_request_http_version()
{
global $request;
+ $version = '';
if ($request && $request->server('SERVER_PROTOCOL'))
{
- return $request->server('SERVER_PROTOCOL');
+ $version = $request->server('SERVER_PROTOCOL');
}
else if (isset($_SERVER['SERVER_PROTOCOL']))
{
- return $_SERVER['SERVER_PROTOCOL'];
+ $version = $_SERVER['SERVER_PROTOCOL'];
+ }
+
+ if (!empty($version) && is_string($version) && preg_match('#^HTTP/[0-9]\.[0-9]$#', $version))
+ {
+ return $version;
}
return 'HTTP/1.0';
@@ -2920,19 +2926,6 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
// Special cases... determine
switch ($result['status'])
{
- case LOGIN_ERROR_ATTEMPTS:
-
- $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
- $captcha->init(CONFIRM_LOGIN);
- // $captcha->reset();
-
- $template->assign_vars(array(
- 'CAPTCHA_TEMPLATE' => $captcha->get_template(),
- ));
-
- $err = $user->lang[$result['error_msg']];
- break;
-
case LOGIN_ERROR_PASSWORD_CONVERT:
$err = sprintf(
$user->lang[$result['error_msg']],
@@ -2943,6 +2936,17 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
);
break;
+ case LOGIN_ERROR_ATTEMPTS:
+
+ $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
+ $captcha->init(CONFIRM_LOGIN);
+ // $captcha->reset();
+
+ $template->assign_vars(array(
+ 'CAPTCHA_TEMPLATE' => $captcha->get_template(),
+ ));
+ // no break;
+
// Username, password, etc...
default:
$err = $user->lang[$result['error_msg']];
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index e30c6da505..d566336d26 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -245,8 +245,13 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
switch ($tpl_type[0])
{
- case 'text':
case 'password':
+ if ($new[$config_key] !== '')
+ {
+ // replace passwords with asterixes
+ $new[$config_key] = '********';
+ }
+ case 'text':
case 'url':
case 'email':
case 'color':
@@ -550,6 +555,9 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
$cfg_array[$config_name] = trim($destination);
+ // Absolute file path
+ case 'absolute_path':
+ case 'absolute_path_writable':
// Path being relative (still prefixed by phpbb_root_path), but with the ability to escape the root dir...
case 'path':
case 'wpath':
@@ -568,20 +576,22 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
break;
}
- if (!file_exists($phpbb_root_path . $cfg_array[$config_name]))
+ $path = in_array($config_definition['validate'], array('wpath', 'path', 'rpath', 'rwpath')) ? $phpbb_root_path . $cfg_array[$config_name] : $cfg_array[$config_name];
+
+ if (!file_exists($path))
{
$error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]);
}
- if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !is_dir($phpbb_root_path . $cfg_array[$config_name]))
+ if (file_exists($path) && !is_dir($path))
{
$error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]);
}
// Check if the path is writable
- if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath')
+ if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath' || $config_definition['validate'] === 'absolute_path_writable')
{
- if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !phpbb_is_writable($phpbb_root_path . $cfg_array[$config_name]))
+ if (file_exists($path) && !phpbb_is_writable($path))
{
$error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]);
}
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 55087ebf59..afd3dce730 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -500,7 +500,7 @@ function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png')
*/
function move_topics($topic_ids, $forum_id, $auto_sync = true)
{
- global $db;
+ global $db, $phpbb_dispatcher;
if (empty($topic_ids))
{
@@ -534,6 +534,27 @@ function move_topics($topic_ids, $forum_id, $auto_sync = true)
}
$table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);
+
+ /**
+ * Perform additional actions before topics move
+ *
+ * @event core.move_topics_before_query
+ * @var array table_ary Array of tables from which forum_id will be updated for all rows that hold the moved topics
+ * @var array topic_ids Array of the moved topic ids
+ * @var string forum_id The forum id from where the topics are moved
+ * @var array forum_ids Array of the forums where the topics are moving (includes also forum_id)
+ * @var bool auto_sync Whether or not to perform auto sync
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'table_ary',
+ 'topic_ids',
+ 'forum_id',
+ 'forum_ids',
+ 'auto_sync',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.move_topics_before_query', compact($vars)));
+
foreach ($table_ary as $table)
{
$sql = "UPDATE $table
@@ -920,7 +941,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
}
$error = false;
- $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+ $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
if ($error)
{
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index b62b514293..8aee80ba34 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -150,7 +150,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);
- $forum_tracking_info = array();
+ $forum_tracking_info = $valid_categories = array();
$branch_root_id = $root_data['forum_id'];
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
@@ -250,6 +250,12 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
}
}
+ // Fill list of categories with forums
+ if (isset($forum_rows[$row['parent_id']]))
+ {
+ $valid_categories[$row['parent_id']] = true;
+ }
+
//
if ($row['parent_id'] == $root_data['forum_id'] || $row['parent_id'] == $branch_root_id)
{
@@ -267,6 +273,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$branch_root_id = $forum_id;
}
$forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id'];
+ $forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password'];
$forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time'];
}
else if ($row['forum_type'] != FORUM_CAT)
@@ -308,6 +315,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name'];
$forum_rows[$parent_id]['forum_last_poster_colour'] = $row['forum_last_poster_colour'];
$forum_rows[$parent_id]['forum_id_last_post'] = $forum_id;
+ $forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password'];
}
}
@@ -404,6 +412,12 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
// Category
if ($row['parent_id'] == $root_data['forum_id'] && $row['forum_type'] == FORUM_CAT)
{
+ // Do not display categories without any forums to display
+ if (!isset($valid_categories[$row['forum_id']]))
+ {
+ continue;
+ }
+
$cat_row = array(
'S_IS_CAT' => true,
'FORUM_ID' => $row['forum_id'],
@@ -522,8 +536,15 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
// Create last post link information, if appropriate
if ($row['forum_last_post_id'])
{
- $last_post_subject = $row['forum_last_post_subject'];
- $last_post_subject_truncated = truncate_string(censor_text($last_post_subject), 30, 255, false, $user->lang['ELLIPSIS']);
+ if ($row['forum_password_last_post'] === '' && $auth->acl_get('f_read', $row['forum_id_last_post']))
+ {
+ $last_post_subject = censor_text($row['forum_last_post_subject']);
+ $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']);
+ }
+ else
+ {
+ $last_post_subject = $last_post_subject_truncated = '';
+ }
$last_post_time = $user->format_date($row['forum_last_post_time']);
$last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&amp;p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id'];
}
@@ -583,7 +604,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false,
'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false,
'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false,
- 'S_DISPLAY_SUBJECT' => ($last_post_subject && $config['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false,
+ 'S_DISPLAY_SUBJECT' => ($last_post_subject !== '' && $config['display_last_subject']) ? true : false,
'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false,
'FORUM_ID' => $row['forum_id'],
@@ -596,8 +617,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '',
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
- 'LAST_POST_SUBJECT' => (!$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? censor_text($last_post_subject) : "",
- 'LAST_POST_SUBJECT_TRUNCATED' => (!$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? $last_post_subject_truncated : "",
+ 'LAST_POST_SUBJECT' => $last_post_subject,
+ 'LAST_POST_SUBJECT_TRUNCATED' => $last_post_subject_truncated,
'LAST_POST_TIME' => $last_post_time,
'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
@@ -732,13 +753,15 @@ function generate_forum_rules(&$forum_data)
function generate_forum_nav(&$forum_data)
{
global $db, $user, $template, $auth, $config;
- global $phpEx, $phpbb_root_path;
+ global $phpEx, $phpbb_root_path, $phpbb_dispatcher;
if (!$auth->acl_get('f_list', $forum_data['forum_id']))
{
return;
}
+ $navlinks = $navlinks_parents = $forum_template_data = array();
+
// Get forum parents
$forum_parents = get_forum_parents($forum_data);
@@ -757,35 +780,59 @@ function generate_forum_nav(&$forum_data)
continue;
}
- $template->assign_block_vars('navlinks', array(
+ $navlinks_parents[] = array(
'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false,
'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false,
'FORUM_NAME' => $parent_name,
'FORUM_ID' => $parent_forum_id,
'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"',
- 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id))
+ 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id),
);
}
}
- $template->assign_block_vars('navlinks', array(
+ $navlinks = array(
'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_ID' => $forum_data['forum_id'],
'MICRODATA' => $microdata_attr . '="' . $forum_data['forum_id'] . '"',
- 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id']))
+ 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id']),
);
- $template->assign_vars(array(
+ $forum_template_data = array(
'FORUM_ID' => $forum_data['forum_id'],
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']),
'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false,
- ));
+ );
+
+ /**
+ * Event to modify the navlinks text
+ *
+ * @event core.generate_forum_nav
+ * @var array forum_data Array with the forum data
+ * @var array forum_template_data Array with generic forum template data
+ * @var string microdata_attr The microdata attribute
+ * @var array navlinks_parents Array with the forum parents navlinks data
+ * @var array navlinks Array with the forum navlinks data
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'forum_data',
+ 'forum_template_data',
+ 'microdata_attr',
+ 'navlinks_parents',
+ 'navlinks',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars)));
+
+ $template->assign_block_vars_array('navlinks', $navlinks_parents);
+ $template->assign_block_vars('navlinks', $navlinks);
+ $template->assign_vars($forum_template_data);
return;
}
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index fe9bcdb9d1..90d59cfd1e 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -976,7 +976,7 @@ class p_master
*
* @param string $class module class (acp/mcp/ucp)
* @param string $name module name (class name of the module, or its basename
- * phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra)
+ * phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra)
* @param string $mode mode, as passed through to the module
*
*/
@@ -1086,7 +1086,7 @@ class p_master
->core_path('language/' . $user->lang_name . '/mods/')
->find();
- $lang_files = array_unique(array_merge($user_lang_files, $english_lang_files, $default_lang_files));
+ $lang_files = array_merge($english_lang_files, $default_lang_files, $user_lang_files);
foreach ($lang_files as $lang_file => $ext_name)
{
$user->add_lang_ext($ext_name, $lang_file);
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 9769e1a517..4f3b7ecfcf 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2209,7 +2209,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
$error = false;
- $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+ $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
if ($error)
{
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index f179b2fd70..89bc31fa25 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -213,6 +213,8 @@ class filespec
*/
static public function get_extension($filename)
{
+ $filename = utf8_basename($filename);
+
if (strpos($filename, '.') === false)
{
return '';
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 9cd662027e..815f07d2e4 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -500,6 +500,9 @@ function user_delete($mode, $user_ids, $retain_username = true)
$num_users_delta = 0;
+ // Get auth provider collection in case accounts might need to be unlinked
+ $provider_collection = $phpbb_container->get('auth.provider_collection');
+
// Some things need to be done in the loop (if the query changes based
// on which user is currently being deleted)
$added_guest_posts = 0;
@@ -510,6 +513,38 @@ function user_delete($mode, $user_ids, $retain_username = true)
avatar_delete('user', $user_row);
}
+ // Unlink accounts
+ foreach ($provider_collection as $provider_name => $auth_provider)
+ {
+ $provider_data = $auth_provider->get_auth_link_data($user_id);
+
+ if ($provider_data !== null)
+ {
+ $link_data = array(
+ 'user_id' => $user_id,
+ 'link_method' => 'user_delete',
+ );
+
+ // BLOCK_VARS might contain hidden fields necessary for unlinking accounts
+ if (isset($provider_data['BLOCK_VARS']) && is_array($provider_data['BLOCK_VARS']))
+ {
+ foreach ($provider_data['BLOCK_VARS'] as $provider_service)
+ {
+ if (!array_key_exists('HIDDEN_FIELDS', $provider_service))
+ {
+ $provider_service['HIDDEN_FIELDS'] = array();
+ }
+
+ $auth_provider->unlink_account(array_merge($link_data, $provider_service['HIDDEN_FIELDS']));
+ }
+ }
+ else
+ {
+ $auth_provider->unlink_account($link_data);
+ }
+ }
+ }
+
// Decrement number of users if this user is active
if ($user_row['user_type'] != USER_INACTIVE && $user_row['user_type'] != USER_IGNORE)
{
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index 500db55456..629b6fd275 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -41,10 +41,27 @@ function mcp_front_view($id, $mode, $action)
if (!empty($forum_list))
{
- $sql = 'SELECT COUNT(post_id) AS total
- FROM ' . POSTS_TABLE . '
- WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
- AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE));
+ $sql_ary = array(
+ 'SELECT' => 'COUNT(post_id) AS total',
+ 'FROM' => array(
+ POSTS_TABLE => 'p',
+ ),
+ 'WHERE' => $db->sql_in_set('p.forum_id', $forum_list) . '
+ AND ' . $db->sql_in_set('p.post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE))
+ );
+
+ /**
+ * Allow altering the query to get the number of unapproved posts
+ *
+ * @event core.mcp_front_queue_unapproved_total_before
+ * @var int sql_ary Query to get the total number of unapproved posts
+ * @var array forum_list List of forums to look for unapproved posts
+ * @since 3.1.5-RC1
+ */
+ $vars = array('sql_ary', 'forum_list');
+ extract($phpbb_dispatcher->trigger_event('core.mcp_front_queue_unapproved_total_before', compact($vars)));
+
+ $sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
$db->sql_freeresult($result);
@@ -157,6 +174,18 @@ function mcp_front_view($id, $mode, $action)
AND r.pm_id = 0
AND r.report_closed = 0
AND ' . $db->sql_in_set('p.forum_id', $forum_list);
+
+ /**
+ * Alter sql query to count the number of reported posts
+ *
+ * @event core.mcp_front_reports_count_query_before
+ * @var int sql The query string used to get the number of reports that exist
+ * @var array forum_list List of forums that contain the posts
+ * @since 3.1.5-RC1
+ */
+ $vars = array('sql', 'forum_list');
+ extract($phpbb_dispatcher->trigger_event('core.mcp_front_reports_count_query_before', compact($vars)));
+
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
$db->sql_freeresult($result);
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 479a48fa05..fc28968101 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -226,6 +226,31 @@ class mcp_main
break;
default:
+ if ($quickmod)
+ {
+ switch ($action)
+ {
+ case 'lock':
+ case 'unlock':
+ case 'make_announce':
+ case 'make_sticky':
+ case 'make_global':
+ case 'make_normal':
+ case 'make_onindex':
+ case 'move':
+ case 'fork':
+ case 'delete_topic':
+ trigger_error('TOPIC_NOT_EXIST');
+ break;
+
+ case 'lock_post':
+ case 'unlock_post':
+ case 'delete_post':
+ trigger_error('POST_NOT_EXIST');
+ break;
+ }
+ }
+
trigger_error('NO_MODE', E_USER_ERROR);
break;
}
@@ -1197,7 +1222,7 @@ function mcp_fork_topic($topic_ids)
}
$error = false;
- $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+ $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
$search_mode = 'post';
if ($error)
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index bc1090a550..f0fc0a3f06 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -26,6 +26,7 @@ function mcp_post_details($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
global $template, $db, $user, $auth, $cache;
+ global $phpbb_dispatcher;
$user->add_lang('posting');
@@ -106,6 +107,21 @@ function mcp_post_details($id, $mode, $action)
}
break;
+
+ default:
+
+ /**
+ * This event allows you to handle custom post moderation options
+ *
+ * @event core.mcp_post_additional_options
+ * @var string action Post moderation action name
+ * @var array post_info Information on the affected post
+ * @since 3.1.5-RC1
+ */
+ $vars = array('action', 'post_info');
+ extract($phpbb_dispatcher->trigger_event('core.mcp_post_additional_options', compact($vars)));
+
+ break;
}
// Set some vars
@@ -197,7 +213,7 @@ function mcp_post_details($id, $mode, $action)
$l_deleted_by = '';
}
- $template->assign_vars(array(
+ $mcp_post_template_data = array(
'U_MCP_ACTION' => "$url&amp;i=main&amp;quickmod=1&amp;mode=post_details", // Use this for mode paramaters
'U_POST_ACTION' => "$url&amp;i=$id&amp;mode=post_details", // Use this for action parameters
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&amp;p=$post_id&amp;f={$post_info['forum_id']}"),
@@ -249,7 +265,32 @@ function mcp_post_details($id, $mode, $action)
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&amp;i=$id&amp;mode=$mode&amp;lookup={$post_info['poster_ip']}#ip" : '',
'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;action=whois&amp;p=$post_id&amp;ip={$post_info['poster_ip']}") : '',
- ));
+ );
+
+ $s_additional_opts = false;
+
+ /**
+ * Event to add/modify MCP post template data
+ *
+ * @event core.mcp_post_template_data
+ * @var array post_info Array with the post information
+ * @var array mcp_post_template_data Array with the MCP post template data
+ * @var array attachments Array with the post attachments, if any
+ * @var bool s_additional_opts Must be set to true in extension if additional options are presented in MCP post panel
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'post_info',
+ 'mcp_post_template_data',
+ 'attachments',
+ 's_additional_opts',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_post_template_data', compact($vars)));
+
+ $template->assign_vars($mcp_post_template_data);
+ $template->assign_var('S_MCP_POST_ADDITIONAL_OPTS', $s_additional_opts);
+
+ unset($mcp_post_template_data);
// Get User Notes
$log_data = array();
@@ -497,7 +538,7 @@ function change_poster(&$post_info, $userdata)
{
// We do some additional checks in the module to ensure it can actually be utilised
$error = false;
- $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+ $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
if (!$error && method_exists($search, 'destroy_cache'))
{
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 804d48ea97..fa2fed842f 100644
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -73,18 +73,66 @@ class mcp_reports
// closed reports are accessed by report id
$report_id = request_var('r', 0);
+ $sql_ary = array(
+ 'SELECT' => 'r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour',
- $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
- FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
- WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
+ 'FROM' => array(
+ REPORTS_TABLE => 'r',
+ REPORTS_REASONS_TABLE => 'rr',
+ USERS_TABLE => 'u',
+ ),
+
+ 'WHERE' => (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
AND rr.reason_id = r.reason_id
AND r.user_id = u.user_id
- AND r.pm_id = 0
- ORDER BY report_closed ASC';
+ AND r.pm_id = 0',
+
+ 'ORDER_BY' => 'report_closed ASC',
+ );
+
+ /**
+ * Allow changing the query to obtain the user-submitted report.
+ *
+ * @event core.mcp_reports_report_details_query_before
+ * @var array sql_ary The array in the format of the query builder with the query
+ * @var mixed forum_id The forum_id, the number in the f GET parameter
+ * @var int post_id The post_id of the report being viewed (if 0, it is meaningless)
+ * @var int report_id The report_id of the report being viewed
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'sql_ary',
+ 'forum_id',
+ 'post_id',
+ 'report_id',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_reports_report_details_query_before', compact($vars)));
+
+ $sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query_limit($sql, 1);
$report = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
+ /**
+ * Allow changing the data obtained from the user-submitted report.
+ *
+ * @event core.mcp_reports_report_details_query_after
+ * @var array sql_ary The array in the format of the query builder with the query that had been executted
+ * @var mixed forum_id The forum_id, the number in the f GET parameter
+ * @var int post_id The post_id of the report being viewed (if 0, it is meaningless)
+ * @var int report_id The report_id of the report being viewed
+ * @var int report The query's resulting row.
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'sql_ary',
+ 'forum_id',
+ 'post_id',
+ 'report_id',
+ 'report',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_reports_report_details_query_after', compact($vars)));
+
if (!$report)
{
trigger_error('NO_REPORT');
@@ -489,6 +537,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
{
$post_id_list[] = $row[$id_column];
}
+ $db->sql_freeresult($result);
$post_id_list = array_unique($post_id_list);
if ($pm)
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 04a2726d22..42ca9bf09d 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -21,6 +21,19 @@ if (!defined('IN_PHPBB'))
if (!class_exists('bbcode'))
{
+ // The following lines are for extensions which include message_parser.php
+ // while $phpbb_root_path and $phpEx are out of the script scope
+ // which may lead to the 'Undefined variable' and 'failed to open stream' errors
+ if (!isset($phpbb_root_path))
+ {
+ global $phpbb_root_path;
+ }
+
+ if (!isset($phpEx))
+ {
+ global $phpEx;
+ }
+
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
}
@@ -115,6 +128,9 @@ class bbcode_firstpass extends bbcode
// [quote] in second position.
// To parse multiline URL we enable dotall option setting only for URL text
// but not for link itself, thus [url][/url] is not affected.
+ //
+ // To perform custom validation in extension, use $this->validate_bbcode_by_extension()
+ // method which accepts variable number of parameters
$this->bbcodes = array(
'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uise' => "\$this->bbcode_code('\$1', '\$2')")),
'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:=&quot;(.*?)&quot;)?\](.+)\[/quote\]#uise' => "\$this->bbcode_quote('\$0')")),
@@ -1862,4 +1878,36 @@ class parse_message extends bbcode_firstpass
{
$this->mimetype_guesser = $mimetype_guesser;
}
+
+ /**
+ * Function to perform custom bbcode validation by extensions
+ * can be used in bbcode_init() to assign regexp replacement
+ * Example: 'regexp' => array('#\[b\](.*?)\[/b\]#uise' => "\$this->validate_bbcode_by_extension('\$1')")
+ *
+ * Accepts variable number of parameters
+ *
+ * @return mixed Validation result
+ */
+ public function validate_bbcode_by_extension()
+ {
+ global $phpbb_dispatcher;
+
+ $return = false;
+ $params_array = func_get_args();
+
+ /**
+ * Event to validate bbcode with the custom validating methods
+ * provided by extensions
+ *
+ * @event core.validate_bbcode_by_extension
+ * @var array params_array Array with the function parameters
+ * @var mixed return Validation result to return
+ *
+ * @since 3.1.5-RC1
+ */
+ $vars = array('params_array', 'return');
+ extract($phpbb_dispatcher->trigger_event('core.validate_bbcode_by_extension', compact($vars)));
+
+ return $return;
+ }
}
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 51018e3a5d..8b7d42e9c9 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -55,7 +55,6 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$address_list = $request->variable('address_list', array('' => array(0 => '')));
- $submit = (isset($_POST['post'])) ? true : false;
$preview = (isset($_POST['preview'])) ? true : false;
$save = (isset($_POST['save'])) ? true : false;
$load = (isset($_POST['load'])) ? true : false;
@@ -69,6 +68,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$refresh = isset($_POST['add_file']) || isset($_POST['delete_file']) || $save || $load
|| $remove_u || $remove_g || $add_to || $add_bcc;
+ $submit = $request->is_set_post('post') && !$refresh && !$preview;
$action = ($delete && !$preview && !$refresh && $submit) ? 'delete' : $action;
$select_single = ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? false : true;
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index 1d3fb19f67..3c274b53c7 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -69,7 +69,7 @@ class ucp_prefs
* @var array data Array with current ucp options data
* @var array error Array with list of errors
* @since 3.1.0-a1
- * @changed 3.1.4-rc1 Added error variable to the event
+ * @changed 3.1.4-RC1 Added error variable to the event
*/
$vars = array('submit', 'data', 'error');
extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars)));
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index 2c786a1d39..8d8d42e742 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -115,16 +115,16 @@ class ucp_profile
}
/**
- * Validate user data on editing profile in UCP
+ * Validate user data on editing registration data in UCP
*
- * @event core.ucp_profile_info_validate_data
+ * @event core.ucp_profile_reg_details_validate
* @var array data Array with user profile data
* @var bool submit Flag indicating if submit button has been pressed
* @var array error Array of any generated errors
* @since 3.1.4-RC1
*/
$vars = array('data', 'submit', 'error');
- extract($phpbb_dispatcher->trigger_event('core.ucp_profile_info_validate_data', compact($vars)));
+ extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_validate', compact($vars)));
if (!sizeof($error))
{
@@ -365,6 +365,18 @@ class ucp_profile
$error[] = 'FORM_INVALID';
}
+ /**
+ * Validate user data on editing profile in UCP
+ *
+ * @event core.ucp_profile_validate_profile_info
+ * @var array data Array with user profile data
+ * @var bool submit Flag indicating if submit button has been pressed
+ * @var array error Array of any generated errors
+ * @since 3.1.4-RC1
+ */
+ $vars = array('data', 'submit', 'error');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_profile_validate_profile_info', compact($vars)));
+
if (!sizeof($error))
{
$data['notify'] = $user->data['user_notify_type'];
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 511f850679..990b3136fd 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -38,7 +38,7 @@ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$convertor_data = array(
'forum_name' => 'phpBB 2.0.x',
'version' => '1.0.3',
- 'phpbb_version' => '3.1.3',
+ 'phpbb_version' => '3.1.4',
'author' => '<a href="https://www.phpbb.com/">phpBB Limited</a>',
'dbms' => $dbms,
'dbhost' => $dbhost,
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index b132ece0d0..a0f8a928de 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -796,7 +796,7 @@ class install_convert extends module
}
$error = false;
- $convert->fulltext_search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+ $convert->fulltext_search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
if ($error)
{
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index f9bd5db204..5b818f9475 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1164,12 +1164,10 @@ class install_install extends module
foreach ($sql_query as $sql)
{
- //$sql = trim(str_replace('|', ';', $sql));
- if (!$db->sql_query($sql))
- {
- $error = $db->sql_error();
- $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
- }
+ // Ignore errors when the functions or types already exist
+ // to allow installing phpBB twice in the same database with
+ // a different prefix
+ $db->sql_query($sql);
}
unset($sql_query);
}
@@ -1494,7 +1492,7 @@ class install_install extends module
set_config_count(null, null, null, $config);
$error = false;
- $search = new \phpbb\search\fulltext_native($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+ $search = new \phpbb\search\fulltext_native($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
$sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
FROM ' . POSTS_TABLE;
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index a39bb365d6..b740977468 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.4-dev');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.5-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');
diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php
index 28cdc8829d..bacb33c70a 100644
--- a/phpBB/language/en/acp/extensions.php
+++ b/phpBB/language/en/acp/extensions.php
@@ -75,7 +75,7 @@ $lang = array_merge($lang, array(
<li>Upload the new files</li>
<li>Enable the extension</li>
</ol>',
- 'EXTENSION_REMOVE_HEADLINE' => 'Completly removing an extension from your board',
+ 'EXTENSION_REMOVE_HEADLINE' => 'Completely removing an extension from your board',
'EXTENSION_REMOVE_EXPLAIN' => '<ol>
<li>Disable the extension</li>
<li>Delete the extension’s data</li>
diff --git a/phpBB/language/en/captcha_recaptcha.php b/phpBB/language/en/captcha_recaptcha.php
index 18438ab53e..df2ad4e51b 100644
--- a/phpBB/language/en/captcha_recaptcha.php
+++ b/phpBB/language/en/captcha_recaptcha.php
@@ -47,6 +47,6 @@ $lang = array_merge($lang, array(
'RECAPTCHA_PRIVATE' => 'Private reCaptcha key',
'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. Keys can be obtained on <a href="http://www.google.com/recaptcha">www.google.com/recaptcha</a>.',
- 'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.',
+ 'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you type the text displayed into the field underneath.',
'RECAPTCHA_SOCKET_ERROR' => 'There was a problem connecting to the RECAPTCHA service: could not open socket. Try again later.',
));
diff --git a/phpBB/language/en/migrator.php b/phpBB/language/en/migrator.php
index f5a56816c2..244a5faadf 100644
--- a/phpBB/language/en/migrator.php
+++ b/phpBB/language/en/migrator.php
@@ -52,6 +52,13 @@ $lang = array_merge($lang, array(
'MIGRATION_SCHEMA_DONE' => 'Installed Schema: %1$s; Time: %2$.2f seconds',
'MIGRATION_SCHEMA_RUNNING' => 'Installing Schema: %s.',
+ 'MIGRATION_INVALID_DATA_MISSING_CONDITION' => 'A migration is invalid. An if statement helper is missing a condition.',
+ 'MIGRATION_INVALID_DATA_MISSING_STEP' => 'A migration is invalid. An if statement helper is missing a valid call to a migration step.',
+ 'MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE' => 'A migration is invalid. A custom callable function could not be called.',
+ 'MIGRATION_INVALID_DATA_UNKNOWN_TYPE' => 'A migration is invalid. An unknown migration tool type was encountered.',
+ 'MIGRATION_INVALID_DATA_UNDEFINED_TOOL' => 'A migration is invalid. An undefined migration tool was encountered.',
+ 'MIGRATION_INVALID_DATA_UNDEFINED_METHOD' => 'A migration is invalid. An undefined migration tool method was encountered.',
+
'MODULE_ERROR' => 'An error occurred while creating a module: %s',
'MODULE_INFO_FILE_NOT_EXIST' => 'A required module info file is missing: %2$s',
'MODULE_NOT_EXIST' => 'A required module does not exist: %s',
diff --git a/phpBB/phpbb/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php
index 4c49070eaf..dea27ccc25 100644
--- a/phpBB/phpbb/auth/provider/base.php
+++ b/phpBB/phpbb/auth/provider/base.php
@@ -61,7 +61,7 @@ abstract class base implements \phpbb\auth\provider\provider_interface
/**
* {@inheritdoc}
*/
- public function get_auth_link_data()
+ public function get_auth_link_data($user_id = 0)
{
return;
}
diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php
index c71950c698..c48b771ab0 100644
--- a/phpBB/phpbb/auth/provider/ldap.php
+++ b/phpBB/phpbb/auth/provider/ldap.php
@@ -289,7 +289,6 @@ class ldap extends \phpbb\auth\provider\base
/**
* {@inheritdoc}
*/
-
public function acp()
{
// These are fields required in the config table
@@ -308,7 +307,7 @@ class ldap extends \phpbb\auth\provider\base
'TEMPLATE_VARS' => array(
'AUTH_LDAP_BASE_DN' => $new_config['ldap_base_dn'],
'AUTH_LDAP_EMAIL' => $new_config['ldap_email'],
- 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'],
+ 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'] !== '' ? '********' : '',
'AUTH_LDAP_PORT' => $new_config['ldap_port'],
'AUTH_LDAP_SERVER' => $new_config['ldap_server'],
'AUTH_LDAP_UID' => $new_config['ldap_uid'],
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index c0ce3f1fba..be0fbf5831 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -553,13 +553,13 @@ class oauth extends \phpbb\auth\provider\base
/**
* {@inheritdoc}
*/
- public function get_auth_link_data()
+ public function get_auth_link_data($user_id = 0)
{
$block_vars = array();
// Get all external accounts tied to the current user
$data = array(
- 'user_id' => (int) $this->user->data['user_id'],
+ 'user_id' => ($user_id <= 0) ? (int) $this->user->data['user_id'] : (int) $user_id,
);
$sql = 'SELECT oauth_provider_id, provider FROM ' . $this->auth_provider_oauth_token_account_assoc . '
WHERE ' . $this->db->sql_build_array('SELECT', $data);
@@ -616,10 +616,13 @@ class oauth extends \phpbb\auth\provider\base
return 'LOGIN_LINK_MISSING_DATA';
}
+ // Remove user specified in $link_data if possible
+ $user_id = isset($link_data['user_id']) ? $link_data['user_id'] : $this->user->data['user_id'];
+
// Remove the link
$sql = 'DELETE FROM ' . $this->auth_provider_oauth_token_account_assoc . "
WHERE provider = '" . $this->db->sql_escape($link_data['oauth_service']) . "'
- AND user_id = " . (int) $this->user->data['user_id'];
+ AND user_id = " . (int) $user_id;
$this->db->sql_query($sql);
// Clear all tokens belonging to the user on this servce
diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php
index 023cf402ca..9b6afae255 100644
--- a/phpBB/phpbb/auth/provider/oauth/token_storage.php
+++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php
@@ -13,7 +13,6 @@
namespace phpbb\auth\provider\oauth;
-
use OAuth\OAuth1\Token\StdOAuth1Token;
use OAuth\Common\Token\TokenInterface;
use OAuth\Common\Storage\TokenStorageInterface;
@@ -117,7 +116,8 @@ class token_storage implements TokenStorageInterface
{
$service = $this->get_service_name_for_db($service);
- if ($this->cachedToken) {
+ if ($this->cachedToken)
+ {
return true;
}
@@ -232,7 +232,8 @@ class token_storage implements TokenStorageInterface
{
$service = $this->get_service_name_for_db($service);
- if ($this->cachedToken instanceof TokenInterface) {
+ if ($this->cachedToken instanceof TokenInterface)
+ {
return $this->cachedToken;
}
diff --git a/phpBB/phpbb/auth/provider/provider_interface.php b/phpBB/phpbb/auth/provider/provider_interface.php
index 613297cefc..35e0f559a1 100644
--- a/phpBB/phpbb/auth/provider/provider_interface.php
+++ b/phpBB/phpbb/auth/provider/provider_interface.php
@@ -166,6 +166,10 @@ interface provider_interface
/**
* Returns an array of data necessary to build the ucp_auth_link page
*
+ * @param int $user_id User ID for whom the data should be retrieved.
+ * defaults to 0, which is not a valid ID. The method
+ * should fall back to the current user's ID in this
+ * case.
* @return array|null If this function is not implemented on an auth
* provider then it returns null. If it is implemented
* it will return an array of up to four elements of
@@ -181,7 +185,7 @@ interface provider_interface
* 'VARS' => array(...),
* )
*/
- public function get_auth_link_data();
+ public function get_auth_link_data($user_id = 0);
/**
* Unlinks an external account from a phpBB account.
diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php
index 8888686b2d..36087f8ba0 100644
--- a/phpBB/phpbb/avatar/driver/local.php
+++ b/phpBB/phpbb/avatar/driver/local.php
@@ -23,8 +23,10 @@ class local extends \phpbb\avatar\driver\driver
*/
public function get_data($row)
{
+ $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $this->path_helper->get_web_root_path();
+
return array(
- 'src' => $this->path_helper->get_web_root_path() . $this->config['avatar_gallery_path'] . '/' . $row['avatar'],
+ 'src' => $root_path . $this->config['avatar_gallery_path'] . '/' . $row['avatar'],
'width' => $row['avatar_width'],
'height' => $row['avatar_height'],
);
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index 003b23659f..ee36243844 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -48,8 +48,10 @@ class upload extends \phpbb\avatar\driver\driver
*/
public function get_data($row, $ignore_config = false)
{
+ $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $this->path_helper->get_web_root_path();
+
return array(
- 'src' => $this->path_helper->get_web_root_path() . 'download/file.' . $this->php_ext . '?avatar=' . $row['avatar'],
+ 'src' => $root_path . 'download/file.' . $this->php_ext . '?avatar=' . $row['avatar'],
'width' => $row['avatar_width'],
'height' => $row['avatar_height'],
);
diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php
index a7ba994cc3..04052b3406 100644
--- a/phpBB/phpbb/captcha/plugins/qa.php
+++ b/phpBB/phpbb/captcha/plugins/qa.php
@@ -125,7 +125,7 @@ class qa
*/
public function is_available()
{
- global $config, $db, $phpbb_root_path, $phpEx, $user;
+ global $config, $db, $user;
// load language file for pretty display in the ACP dropdown
$user->add_lang('captcha_qa');
@@ -263,7 +263,7 @@ class qa
*/
function garbage_collect($type = 0)
{
- global $db, $config;
+ global $db;
$sql = 'SELECT c.confirm_id
FROM ' . $this->table_qa_confirm . ' c
@@ -310,8 +310,6 @@ class qa
$db_tool = new \phpbb\db\tools($db);
- $tables = array($this->table_captcha_questions, $this->table_captcha_answers, $this->table_qa_confirm);
-
$schemas = array(
$this->table_captcha_questions => array (
'COLUMNS' => array(
@@ -366,7 +364,7 @@ class qa
*/
function validate()
{
- global $config, $db, $user;
+ global $user;
$error = '';
@@ -414,7 +412,7 @@ class qa
if (!sizeof($this->question_ids))
{
- return false;
+ return;
}
$this->confirm_id = md5(unique_id($user->ip));
$this->question = (int) array_rand($this->question_ids);
@@ -440,7 +438,7 @@ class qa
if (!sizeof($this->question_ids))
{
- return false;
+ return;
}
$this->question = (int) array_rand($this->question_ids);
@@ -611,8 +609,8 @@ class qa
*/
function acp_page($id, &$module)
{
- global $db, $user, $auth, $template;
- global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
+ global $user, $template;
+ global $config;
$user->add_lang('acp/board');
$user->add_lang('captcha_qa');
@@ -674,11 +672,7 @@ class qa
else
{
// okay, show the editor
- $error = false;
- $input_question = request_var('question_text', '', true);
- $input_answers = request_var('answers', '', true);
- $input_lang = request_var('lang_iso', '', true);
- $input_strict = request_var('strict', false);
+ $question_input = $this->acp_get_question_input();
$langs = $this->get_languages();
foreach ($langs as $lang => $entry)
@@ -697,13 +691,11 @@ class qa
{
if ($question = $this->acp_get_question_data($question_id))
{
- $answers = (isset($input_answers[$lang])) ? $input_answers[$lang] : implode("\n", $question['answers']);
-
$template->assign_vars(array(
- 'QUESTION_TEXT' => ($input_question) ? $input_question : $question['question_text'],
- 'LANG_ISO' => ($input_lang) ? $input_lang : $question['lang_iso'],
- 'STRICT' => (isset($_REQUEST['strict'])) ? $input_strict : $question['strict'],
- 'ANSWERS' => $answers,
+ 'QUESTION_TEXT' => ($question_input['question_text']) ? $question_input['question_text'] : $question['question_text'],
+ 'LANG_ISO' => ($question_input['lang_iso']) ? $question_input['lang_iso'] : $question['lang_iso'],
+ 'STRICT' => (isset($_REQUEST['strict'])) ? $question_input['strict'] : $question['strict'],
+ 'ANSWERS' => implode("\n", $question['answers']),
));
}
else
@@ -714,18 +706,16 @@ class qa
else
{
$template->assign_vars(array(
- 'QUESTION_TEXT' => $input_question,
- 'LANG_ISO' => $input_lang,
- 'STRICT' => $input_strict,
- 'ANSWERS' => $input_answers,
+ 'QUESTION_TEXT' => $question_input['question_text'],
+ 'LANG_ISO' => $question_input['lang_iso'],
+ 'STRICT' => $question_input['strict'],
+ 'ANSWERS' => (is_array($question_input['answers'])) ? implode("\n", $question_input['answers']) : '',
));
}
if ($submit && check_form_key($form_key))
{
- $data = $this->acp_get_question_input();
-
- if (!$this->validate_input($data))
+ if (!$this->validate_input($question_input))
{
$template->assign_vars(array(
'S_ERROR' => true,
@@ -735,11 +725,11 @@ class qa
{
if ($question_id)
{
- $this->acp_update_question($data, $question_id);
+ $this->acp_update_question($question_input, $question_id);
}
else
{
- $this->acp_add_question($data);
+ $this->acp_add_question($question_input);
}
add_log('admin', 'LOG_CONFIG_VISUAL');
@@ -819,6 +809,8 @@ class qa
return $question;
}
+
+ return false;
}
/**
@@ -827,13 +819,21 @@ class qa
function acp_get_question_input()
{
$answers = utf8_normalize_nfc(request_var('answers', '', true));
+
+ // Convert answers into array and filter if answers are set
+ if (strlen($answers))
+ {
+ $answers = array_filter(array_map('trim', explode("\n", $answers)), function ($value) {
+ return $value !== '';
+ });
+ }
+
$question = array(
'question_text' => request_var('question_text', '', true),
'strict' => request_var('strict', false),
'lang_iso' => request_var('lang_iso', ''),
- 'answers' => (strlen($answers)) ? explode("\n", $answers) : '',
+ 'answers' => $answers,
);
-
return $question;
}
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index 700009da6a..0ba0489cb7 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -237,7 +237,7 @@ class content_visibility
if (!sizeof($forum_ids))
{
// The user can see all posts/topics in all specified forums
- return $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums);
+ return $where_sql . $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums) . ')';
}
else
{
@@ -248,8 +248,8 @@ class content_visibility
else
{
// The user is just a normal user
- return $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . '
- AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true);
+ return $where_sql . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . '
+ AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true) . ')';
}
$where_sql .= '(' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . '
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index c6c470e91b..a07a396e73 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -13,6 +13,7 @@
namespace phpbb\controller;
+use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@@ -142,6 +143,12 @@ class helper
$base_url = $context->getBaseUrl();
+ // Append page name if base URL does not contain it
+ if (!empty($page_name) && strpos($base_url, '/' . $page_name) === false)
+ {
+ $base_url .= '/' . $page_name;
+ }
+
// If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it.
$base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url);
@@ -206,12 +213,31 @@ class helper
public function message($message, array $parameters = array(), $title = 'INFORMATION', $code = 200)
{
array_unshift($parameters, $message);
+ $message_text = call_user_func_array(array($this->user, 'lang'), $parameters);
+ $message_title = $this->user->lang($title);
+
+ if ($this->request->is_ajax())
+ {
+ global $refresh_data;
+
+ return new JsonResponse(
+ array(
+ 'MESSAGE_TITLE' => $message_title,
+ 'MESSAGE_TEXT' => $message_text,
+ 'S_USER_WARNING' => false,
+ 'S_USER_NOTICE' => false,
+ 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null
+ ),
+ $code
+ );
+ }
+
$this->template->assign_vars(array(
- 'MESSAGE_TEXT' => call_user_func_array(array($this->user, 'lang'), $parameters),
- 'MESSAGE_TITLE' => $this->user->lang($title),
+ 'MESSAGE_TEXT' => $message_text,
+ 'MESSAGE_TITLE' => $message_title,
));
- return $this->render('message_body.html', $this->user->lang($title), $code);
+ return $this->render('message_body.html', $message_title, $code);
}
/**
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php
new file mode 100644
index 0000000000..51475f5a05
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14.php
@@ -0,0 +1,37 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_14 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return phpbb_version_compare($this->config['version'], '3.0.14', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
+ }
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v30x\release_3_0_14_rc1');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ phpbb_version_compare($this->config['version'], '3.0.14', '<'),
+ array('config.update', array('version', '3.0.14')),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php
new file mode 100644
index 0000000000..421ef06dd3
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_14_rc1.php
@@ -0,0 +1,37 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_14_rc1 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return phpbb_version_compare($this->config['version'], '3.0.14-RC1', '>=') && phpbb_version_compare($this->config['version'], '3.1.0-dev', '<');
+ }
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v30x\release_3_0_13');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ phpbb_version_compare($this->config['version'], '3.0.14-RC1', '<'),
+ array('config.update', array('version', '3.0.14-RC1')),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/avatars.php b/phpBB/phpbb/db/migration/data/v310/avatars.php
index 2698adeed5..9b03a8fa94 100644
--- a/phpBB/phpbb/db/migration/data/v310/avatars.php
+++ b/phpBB/phpbb/db/migration/data/v310/avatars.php
@@ -17,7 +17,29 @@ class avatars extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
- return isset($this->config['allow_avatar_gravatar']);
+ // Get current avatar type of guest user
+ $sql = 'SELECT user_avatar_type
+ FROM ' . $this->table_prefix . 'users
+ WHERE user_id = ' . ANONYMOUS;
+ $result = $this->db->sql_query($sql);
+ $backup_type = $this->db->sql_fetchfield('user_avatar_type');
+ $this->db->sql_freeresult($result);
+
+ // Try to set avatar type to string
+ $sql = 'UPDATE ' . $this->table_prefix . "users
+ SET user_avatar_type = 'avatar.driver.upload'
+ WHERE user_id = " . ANONYMOUS;
+ $this->db->sql_return_on_error(true);
+ $effectively_installed = $this->db->sql_query($sql);
+ $this->db->sql_return_on_error();
+
+ // Restore avatar type of guest user to previous state
+ $sql = 'UPDATE ' . $this->table_prefix . "users
+ SET user_avatar_type = '{$backup_type}'
+ WHERE user_id = " . ANONYMOUS;
+ $this->db->sql_query($sql);
+
+ return $effectively_installed !== false;
}
static public function depends_on()
diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
index e8d3a3af64..3b0d53d803 100644
--- a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
+++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
@@ -136,7 +136,7 @@ class style_update_p1 extends \phpbb\db\migration\migration
if (!sizeof($valid_styles))
{
// No valid styles: remove everything and add prosilver
- $this->sql_query('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary);
+ $this->sql_query('DELETE FROM ' . STYLES_TABLE);
$sql_ary = array(
'style_name' => 'prosilver',
@@ -157,13 +157,13 @@ class style_update_p1 extends \phpbb\db\migration\migration
$this->sql_query($sql);
$sql = 'SELECT style_id
- FROM ' . $table . "
+ FROM ' . STYLES_TABLE . "
WHERE style_name = 'prosilver'";
$result = $this->sql_query($sql);
$default_style = $this->db->sql_fetchfield($result);
$this->db->sql_freeresult($result);
- set_config('default_style', $default_style);
+ $this->config->set('default_style', $default_style);
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0';
$this->sql_query($sql);
diff --git a/phpBB/phpbb/db/migration/data/v31x/v314.php b/phpBB/phpbb/db/migration/data/v31x/v314.php
new file mode 100644
index 0000000000..b7793ca569
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v314.php
@@ -0,0 +1,32 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v31x;
+
+class v314 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v30x\release_3_0_14',
+ '\phpbb\db\migration\data\v31x\v314rc2',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.4')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v31x/v314rc1.php b/phpBB/phpbb/db/migration/data/v31x/v314rc1.php
new file mode 100644
index 0000000000..10cdbe3f9c
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v314rc1.php
@@ -0,0 +1,31 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v31x;
+
+class v314rc1 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v313',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.4-RC1')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v31x/v314rc2.php b/phpBB/phpbb/db/migration/data/v31x/v314rc2.php
new file mode 100644
index 0000000000..b75b7a9be8
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v314rc2.php
@@ -0,0 +1,32 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v31x;
+
+class v314rc2 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v30x\release_3_0_14_rc1',
+ '\phpbb\db\migration\data\v31x\v314rc1',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.4-RC2')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php
index 14e3c54f09..18e4814a77 100644
--- a/phpBB/phpbb/db/sql_insert_buffer.php
+++ b/phpBB/phpbb/db/sql_insert_buffer.php
@@ -107,7 +107,7 @@ class sql_insert_buffer
* first building a huge rowset. Or at least sizeof($rows) should be kept
* small.
*
- * @param array $rows
+ * @param array $rows
*
* @return bool True when some data was flushed to the database.
* False otherwise.
diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php
index f7021875f3..02c2a1b9d6 100644
--- a/phpBB/phpbb/event/md_exporter.php
+++ b/phpBB/phpbb/event/md_exporter.php
@@ -24,6 +24,12 @@ class md_exporter
/** @var string phpBB Root Path */
protected $root_path;
+ /** @var string The minimum version for the events to return */
+ protected $min_version;
+
+ /** @var string The maximum version for the events to return */
+ protected $max_version;
+
/** @var string */
protected $filter;
@@ -36,8 +42,10 @@ class md_exporter
/**
* @param string $phpbb_root_path
* @param mixed $extension String 'vendor/ext' to filter, null for phpBB core
+ * @param string $min_version
+ * @param string $max_version
*/
- public function __construct($phpbb_root_path, $extension = null)
+ public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null)
{
$this->root_path = $phpbb_root_path;
$this->path = $this->root_path;
@@ -49,6 +57,8 @@ class md_exporter
$this->events = array();
$this->events_by_file = array();
$this->filter = $this->current_event = '';
+ $this->min_version = $min_version;
+ $this->max_version = $max_version;
}
/**
@@ -147,15 +157,64 @@ class md_exporter
}
list($file_details, $details) = explode("\n* Since: ", $details, 2);
- list($since, $description) = explode("\n* Purpose: ", $details, 2);
+
+ $changed_versions = array();
+ if (strpos($details, "\n* Changed: ") !== false)
+ {
+ list($since, $details) = explode("\n* Changed: ", $details, 2);
+ while (strpos($details, "\n* Changed: ") !== false)
+ {
+ list($changed, $details) = explode("\n* Changed: ", $details, 2);
+ $changed_versions[] = $changed;
+ }
+ list($changed, $description) = explode("\n* Purpose: ", $details, 2);
+ $changed_versions[] = $changed;
+ }
+ else
+ {
+ list($since, $description) = explode("\n* Purpose: ", $details, 2);
+ $changed_versions = array();
+ }
$files = $this->validate_file_list($file_details);
$since = $this->validate_since($since);
+ $changes = array();
+ foreach ($changed_versions as $changed)
+ {
+ list($changed_version, $changed_description) = $this->validate_changed($changed);
+
+ if (isset($changes[$changed_version]))
+ {
+ throw new \LogicException("Duplicate change information found for event '{$this->current_event}'");
+ }
+
+ $changes[$changed_version] = $changed_description;
+ }
+ $description = trim($description, "\n") . "\n";
+
+ if (!$this->version_is_filtered($since))
+ {
+ $is_filtered = false;
+ foreach ($changes as $version => $null)
+ {
+ if ($this->version_is_filtered($version))
+ {
+ $is_filtered = true;
+ break;
+ }
+ }
+
+ if (!$is_filtered)
+ {
+ continue;
+ }
+ }
$this->events[$event_name] = array(
'event' => $this->current_event,
'files' => $files,
'since' => $since,
+ 'changed' => $changes,
'description' => $description,
);
}
@@ -164,20 +223,48 @@ class md_exporter
}
/**
+ * The version to check
+ *
+ * @param string $version
+ * @return bool
+ */
+ protected function version_is_filtered($version)
+ {
+ return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<='))
+ && (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>='));
+ }
+
+ /**
* Format the php events as a wiki table
+ *
+ * @param string $action
* @return string Number of events found
*/
- public function export_events_for_wiki()
+ public function export_events_for_wiki($action = '')
{
if ($this->filter === 'adm')
{
- $wiki_page = '= ACP Template Events =' . "\n";
+ if ($action === 'diff')
+ {
+ $wiki_page = '=== ACP Template Events ===' . "\n";
+ }
+ else
+ {
+ $wiki_page = '= ACP Template Events =' . "\n";
+ }
$wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n";
$wiki_page .= '! Identifier !! Placement !! Added in Release !! Explanation' . "\n";
}
else
{
- $wiki_page = '= Template Events =' . "\n";
+ if ($action === 'diff')
+ {
+ $wiki_page = '=== Template Events ===' . "\n";
+ }
+ else
+ {
+ $wiki_page = '= Template Events =' . "\n";
+ }
$wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n";
$wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Subsilver Placement (If applicable) !! Added in Release !! Explanation' . "\n";
}
@@ -227,7 +314,7 @@ class md_exporter
*/
public function validate_since($since)
{
- if (!preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $since))
+ if (!$this->validate_version($since))
{
throw new \LogicException("Invalid since information found for event '{$this->current_event}'");
}
@@ -236,6 +323,44 @@ class md_exporter
}
/**
+ * Validate "Changed" Information
+ *
+ * @param string $changed
+ * @return string
+ * @throws \LogicException
+ */
+ public function validate_changed($changed)
+ {
+ if (strpos($changed, ' ') !== false)
+ {
+ list($version, $description) = explode(' ', $changed, 2);
+ }
+ else
+ {
+ $version = $changed;
+ $description = '';
+ }
+
+ if (!$this->validate_version($version))
+ {
+ throw new \LogicException("Invalid changed information found for event '{$this->current_event}'");
+ }
+
+ return array($version, $description);
+ }
+
+ /**
+ * Validate "version" Information
+ *
+ * @param string $version
+ * @return bool True if valid, false otherwise
+ */
+ public function validate_version($version)
+ {
+ return preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $version);
+ }
+
+ /**
* Validate the files list
*
* @param string $file_details
diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php
index 35144eeeec..d2ab0595c0 100644
--- a/phpBB/phpbb/event/php_exporter.php
+++ b/phpBB/phpbb/event/php_exporter.php
@@ -25,6 +25,12 @@ class php_exporter
/** @var string phpBB Root Path */
protected $root_path;
+ /** @var string The minimum version for the events to return */
+ protected $min_version;
+
+ /** @var string The maximum version for the events to return */
+ protected $max_version;
+
/** @var string */
protected $current_file;
@@ -43,14 +49,18 @@ class php_exporter
/**
* @param string $phpbb_root_path
* @param mixed $extension String 'vendor/ext' to filter, null for phpBB core
+ * @param string $min_version
+ * @param string $max_version
*/
- public function __construct($phpbb_root_path, $extension = null)
+ public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null)
{
$this->root_path = $phpbb_root_path;
$this->path = $phpbb_root_path;
$this->events = $this->file_lines = array();
$this->current_file = $this->current_event = '';
$this->current_event_line = 0;
+ $this->min_version = $min_version;
+ $this->max_version = $max_version;
$this->path = $this->root_path;
if ($extension)
@@ -148,11 +158,20 @@ class php_exporter
/**
* Format the php events as a wiki table
+ *
+ * @param string $action
* @return string
*/
- public function export_events_for_wiki()
+ public function export_events_for_wiki($action = '')
{
- $wiki_page = '= PHP Events (Hook Locations) =' . "\n";
+ if ($action === 'diff')
+ {
+ $wiki_page = '=== PHP Events (Hook Locations) ===' . "\n";
+ }
+ else
+ {
+ $wiki_page = '= PHP Events (Hook Locations) =' . "\n";
+ }
$wiki_page .= '{| class="sortable zebra" cellspacing="0" cellpadding="5"' . "\n";
$wiki_page .= '! Identifier !! Placement !! Arguments !! Added in Release !! Explanation' . "\n";
foreach ($this->events as $event)
@@ -215,6 +234,34 @@ class php_exporter
$since_line_num = $this->find_since();
$since = $this->validate_since($this->file_lines[$since_line_num]);
+ $changed_line_nums = $this->find_changed('changed');
+ if (empty($changed_line_nums))
+ {
+ $changed_line_nums = $this->find_changed('change');
+ }
+ $changed_versions = array();
+ if (!empty($changed_line_nums))
+ {
+ foreach ($changed_line_nums as $changed_line_num)
+ {
+ $changed_versions[] = $this->validate_changed($this->file_lines[$changed_line_num]);
+ }
+ }
+
+ if (!$this->version_is_filtered($since))
+ {
+ $valid_version = false;
+ foreach ($changed_versions as $changed)
+ {
+ $valid_version = $valid_version || $this->version_is_filtered($changed);
+ }
+
+ if (!$valid_version)
+ {
+ continue;
+ }
+ }
+
// Find event description line
$description_line_num = $this->find_description();
$description = substr(trim($this->file_lines[$description_line_num]), strlen('* '));
@@ -243,6 +290,18 @@ class php_exporter
}
/**
+ * The version to check
+ *
+ * @param string $version
+ * @return bool
+ */
+ protected function version_is_filtered($version)
+ {
+ return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<='))
+ && (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>='));
+ }
+
+ /**
* Find the name of the event inside the dispatch() line
*
* @param int $event_line
@@ -449,6 +508,33 @@ class php_exporter
}
/**
+ * Find the "@changed" Information lines
+ *
+ * @param string $tag_name Should be 'changed' or 'change'
+ * @return array Absolute line numbers
+ * @throws \LogicException
+ */
+ public function find_changed($tag_name)
+ {
+ $lines = array();
+ $last_line = 0;
+ try
+ {
+ while ($line = $this->find_tag($tag_name, array('since'), $last_line))
+ {
+ $lines[] = $line;
+ $last_line = $line;
+ }
+ }
+ catch (\LogicException $e)
+ {
+ // Not changed? No problem!
+ }
+
+ return $lines;
+ }
+
+ /**
* Find the "@event" Information line
*
* @return int Absolute line number
@@ -464,13 +550,14 @@ class php_exporter
* @param string $find_tag Name of the tag we are trying to find
* @param array $disallowed_tags List of tags that must not appear between
* the tag and the actual event
+ * @param int $skip_to_line Skip lines until this one
* @return int Absolute line number
* @throws \LogicException
*/
- public function find_tag($find_tag, $disallowed_tags)
+ public function find_tag($find_tag, $disallowed_tags, $skip_to_line = 0)
{
- $find_tag_line = 0;
- $found_comment_end = false;
+ $find_tag_line = $skip_to_line ? $this->current_event_line - $skip_to_line + 1 : 0;
+ $found_comment_end = ($skip_to_line) ? true : false;
while (strpos(ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t "), '* @' . $find_tag . ' ') !== 0)
{
if ($found_comment_end && ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t") === '/**')
@@ -561,6 +648,27 @@ class php_exporter
}
/**
+ * Validate "@changed" Information
+ *
+ * @param string $line
+ * @return string
+ * @throws \LogicException
+ */
+ public function validate_changed($line)
+ {
+ $match = array();
+ $line = str_replace("\t", ' ', ltrim($line, "\t "));
+ preg_match('#^\* @change(d)? (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match);
+ if (!isset($match[2]))
+ {
+ throw new \LogicException("Invalid '@changed' information for event "
+ . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'");
+ }
+
+ return $match[2];
+ }
+
+ /**
* Validate "@event" Information
*
* @param string $event_name
diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index 0c5205530b..f4ba76ff0c 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -521,15 +521,77 @@ class log implements \phpbb\log\log_interface
$sql_keywords = $this->generate_sql_keyword($keywords);
}
- if ($count_logs)
- {
- $sql = 'SELECT COUNT(l.log_id) AS total_entries
- FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u
- WHERE l.log_type = ' . (int) $log_type . '
+ $get_logs_sql_ary = array(
+ 'SELECT' => 'l.*, u.username, u.username_clean, u.user_colour',
+ 'FROM' => array(
+ $this->log_table => 'l',
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => 'l.log_type = ' . (int) $log_type . "
AND l.user_id = u.user_id
- AND l.log_time >= ' . (int) $log_time . "
$sql_keywords
- $sql_additional";
+ $sql_additional",
+
+ 'ORDER_BY' => $sort_by,
+ );
+
+ if($log_time)
+ {
+ $get_logs_sql_ary['WHERE'] = 'l.log_time >= ' . (int) $log_time . '
+ AND ' . $get_logs_sql_ary['WHERE'];
+ }
+
+ /**
+ * Modify the query to obtain the logs data
+ *
+ * @event core.get_logs_main_query_before
+ * @var array get_logs_sql_ary The array in the format of the query builder with the query
+ * to get the log count and the log list
+ * @var string mode Mode of the entries we display
+ * @var bool count_logs Do we count all matching entries?
+ * @var int limit Limit the number of entries
+ * @var int offset Offset when fetching the entries
+ * @var mixed forum_id Limit entries to the forum_id,
+ * can also be an array of forum_ids
+ * @var int topic_id Limit entries to the topic_id
+ * @var int user_id Limit entries to the user_id
+ * @var int log_time Limit maximum age of log entries
+ * @var string sort_by SQL order option
+ * @var string keywords Will only return entries that have the
+ * keywords in log_operation or log_data
+ * @var string profile_url URL to the users profile
+ * @var int log_type Limit logs to a certain type. If log_type
+ * is false, no entries will be returned.
+ * @var string sql_additional Additional conditions for the entries,
+ * e.g.: 'AND l.forum_id = 1'
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'get_logs_sql_ary',
+ 'mode',
+ 'count_logs',
+ 'limit',
+ 'offset',
+ 'forum_id',
+ 'topic_id',
+ 'user_id',
+ 'log_time',
+ 'sort_by',
+ 'keywords',
+ 'profile_url',
+ 'log_type',
+ 'sql_additional',
+ );
+ extract($this->dispatcher->trigger_event('core.get_logs_main_query_before', compact($vars)));
+
+ if ($count_logs)
+ {
+ $count_logs_sql_ary = $get_logs_sql_ary;
+
+ $count_logs_sql_ary['SELECT'] = 'COUNT(l.log_id) AS total_entries';
+ unset($count_logs_sql_ary['ORDER_BY']);
+
+ $sql = $this->db->sql_build_query('SELECT', $count_logs_sql_ary);
$result = $this->db->sql_query($sql);
$this->entry_count = (int) $this->db->sql_fetchfield('total_entries');
$this->db->sql_freeresult($result);
@@ -548,14 +610,7 @@ class log implements \phpbb\log\log_interface
}
}
- $sql = 'SELECT l.*, u.username, u.username_clean, u.user_colour
- FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u
- WHERE l.log_type = ' . (int) $log_type . '
- AND u.user_id = l.user_id
- ' . (($log_time) ? 'AND l.log_time >= ' . (int) $log_time : '') . "
- $sql_keywords
- $sql_additional
- ORDER BY $sort_by";
+ $sql = $this->db->sql_build_query('SELECT', $get_logs_sql_ary);
$result = $this->db->sql_query_limit($sql, $limit, $this->last_page_offset);
$i = 0;
diff --git a/phpBB/phpbb/notification/method/base.php b/phpBB/phpbb/notification/method/base.php
index a0bbed6fcd..6ee1d2984a 100644
--- a/phpBB/phpbb/notification/method/base.php
+++ b/phpBB/phpbb/notification/method/base.php
@@ -60,7 +60,7 @@ abstract class base implements \phpbb\notification\method\method_interface
/**
* Notification Method Base Constructor
- *
+ *
* @param \phpbb\user_loader $user_loader
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\cache\driver\driver_interface $cache
@@ -85,7 +85,7 @@ abstract class base implements \phpbb\notification\method\method_interface
/**
* Set notification manager (required)
- *
+ *
* @param \phpbb\notification\manager $notification_manager
*/
public function set_notification_manager(\phpbb\notification\manager $notification_manager)
diff --git a/phpBB/phpbb/passwords/driver/helper.php b/phpBB/phpbb/passwords/driver/helper.php
index caa65080ac..f80c3e3df6 100644
--- a/phpBB/phpbb/passwords/driver/helper.php
+++ b/phpBB/phpbb/passwords/driver/helper.php
@@ -153,11 +153,23 @@ class helper
*/
public function string_compare($string_a, $string_b)
{
- $difference = strlen($string_a) != strlen($string_b);
+ // Return if input variables are not strings or if length does not match
+ if (!is_string($string_a) || !is_string($string_b) || strlen($string_a) != strlen($string_b))
+ {
+ return false;
+ }
+
+ // Use hash_equals() if it's available
+ if (function_exists('hash_equals'))
+ {
+ return hash_equals($string_a, $string_b);
+ }
+
+ $difference = 0;
for ($i = 0; $i < strlen($string_a) && $i < strlen($string_b); $i++)
{
- $difference |= $string_a[$i] != $string_b[$i];
+ $difference |= ord($string_a[$i]) ^ ord($string_b[$i]);
}
return $difference === 0;
diff --git a/phpBB/phpbb/passwords/manager.php b/phpBB/phpbb/passwords/manager.php
index fbb49d86a0..aa9147ecf4 100644
--- a/phpBB/phpbb/passwords/manager.php
+++ b/phpBB/phpbb/passwords/manager.php
@@ -56,7 +56,7 @@ class manager
* @param array $hashing_algorithms Hashing driver
* service collection
* @param \phpbb\passwords\helper $helper Passwords helper object
- * @param string $defaults List of default driver types
+ * @param array $defaults List of default driver types
*/
public function __construct(\phpbb\config\config $config, $hashing_algorithms, helper $helper, $defaults)
{
diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php
index 9b3dcadf32..82f59b5c20 100644
--- a/phpBB/phpbb/permissions.php
+++ b/phpBB/phpbb/permissions.php
@@ -277,13 +277,14 @@ class permissions
'm_approve' => array('lang' => 'ACL_M_APPROVE', 'cat' => 'post_actions'),
'm_report' => array('lang' => 'ACL_M_REPORT', 'cat' => 'post_actions'),
'm_chgposter' => array('lang' => 'ACL_M_CHGPOSTER', 'cat' => 'post_actions'),
+ 'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'post_actions'),
+ 'm_softdelete' => array('lang' => 'ACL_M_SOFTDELETE', 'cat' => 'post_actions'),
'm_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'),
'm_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'),
'm_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'),
'm_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'),
- 'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'misc'),
'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'),
'm_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'),
diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php
index 3c686a552f..ca78167ec0 100644
--- a/phpBB/phpbb/plupload/plupload.php
+++ b/phpBB/phpbb/plupload/plupload.php
@@ -267,8 +267,8 @@ class plupload
{
$resize = sprintf(
'resize: {width: %d, height: %d, quality: 100},',
- (int) $this->config['img_max_height'],
- (int) $this->config['img_max_width']
+ (int) $this->config['img_max_width'],
+ (int) $this->config['img_max_height']
);
}
@@ -326,7 +326,7 @@ class plupload
$tmp_file = $this->temporary_filepath($upload['tmp_name']);
- if (!move_uploaded_file($upload['tmp_name'], $tmp_file))
+ if (!phpbb_is_writable($this->temporary_directory) || !move_uploaded_file($upload['tmp_name'], $tmp_file))
{
$this->emit_error(103, 'PLUPLOAD_ERR_MOVE_UPLOADED');
}
diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php
index 5ca39f1683..bc6f2a4398 100644
--- a/phpBB/phpbb/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -43,7 +43,7 @@ class fulltext_mysql extends \phpbb\search\base
protected $db;
/**
- * PhpBB event dispatcher object
+ * phpBB event dispatcher object
* @var \phpbb\event\dispatcher_interface
*/
protected $phpbb_dispatcher;
@@ -84,10 +84,10 @@ class fulltext_mysql extends \phpbb\search\base
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\config\config $config Config object
* @param \phpbb\db\driver\driver_interface Database object
- * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
* @param \phpbb\user $user User object
+ * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
*/
- public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user)
+ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher)
{
$this->config = $config;
$this->db = $db;
@@ -455,6 +455,55 @@ class fulltext_mysql extends \phpbb\search\base
break;
}
+ $search_query = $this->search_query;
+
+ /**
+ * Allow changing the query used to search for posts using fulltext_mysql
+ *
+ * @event core.search_mysql_keywords_main_query_before
+ * @var string search_query The parsed keywords used for this search
+ * @var int result_count The previous result count for the format of the query.
+ * Set to 0 to force a re-count
+ * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED
+ * @var array author_ary Array of user_id containing the users to filter the results to
+ * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant)
+ * @var array ex_fid_ary Which forums not to search on
+ * @var int topic_id Limit the search to this topic_id only
+ * @var string sql_sort_table Extra tables to include in the SQL query.
+ * Used in conjunction with sql_sort_join
+ * @var string sql_sort_join SQL conditions to join all the tables used together.
+ * Used in conjunction with sql_sort_table
+ * @var int sort_days Time, in days, of the oldest possible post to list
+ * @var string sql_match Which columns to do the search on.
+ * @var string sql_match_where Extra conditions to use to properly filter the matching process
+ * @var string sort_by_sql The possible predefined sort types
+ * @var string sort_key The sort type used from the possible sort types
+ * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used
+ * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir
+ * @var int start How many posts to skip in the search results (used for pagination)
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'search_query',
+ 'result_count',
+ 'join_topic',
+ 'author_ary',
+ 'author_name',
+ 'ex_fid_ary',
+ 'topic_id',
+ 'sql_sort_table',
+ 'sql_sort_join',
+ 'sort_days',
+ 'sql_match',
+ 'sql_match_where',
+ 'sort_by_sql',
+ 'sort_key',
+ 'sort_dir',
+ 'sql_sort',
+ 'start',
+ );
+ extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_keywords_main_query_before', compact($vars)));
+
$sql_select = (!$result_count) ? 'SQL_CALC_FOUND_ROWS ' : '';
$sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id';
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index d4c1bbc4b9..c2cae3b37e 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -87,7 +87,7 @@ class fulltext_native extends \phpbb\search\base
protected $db;
/**
- * PhpBB event dispatcher object
+ * phpBB event dispatcher object
* @var \phpbb\event\dispatcher_interface
*/
protected $phpbb_dispatcher;
@@ -104,7 +104,7 @@ class fulltext_native extends \phpbb\search\base
* @param boolean|string &$error is passed by reference and should either be set to false on success or an error message on failure
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
*/
- public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user)
+ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
@@ -720,6 +720,68 @@ class fulltext_native extends \phpbb\search\base
$sql_where[] = $post_visibility;
+ $search_query = $this->search_query;
+ $must_exclude_one_ids = $this->must_exclude_one_ids;
+ $must_not_contain_ids = $this->must_not_contain_ids;
+ $must_contain_ids = $this->must_contain_ids;
+
+ /**
+ * Allow changing the query used for counting for posts using fulltext_native
+ *
+ * @event core.search_native_keywords_count_query_before
+ * @var string search_query The parsed keywords used for this search
+ * @var array must_not_contain_ids Ids that cannot be taken into account for the results
+ * @var array must_exclude_one_ids Ids that cannot be on the results
+ * @var array must_contain_ids Ids that must be on the results
+ * @var int result_count The previous result count for the format of the query
+ * Set to 0 to force a re-count
+ * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED
+ * @var array author_ary Array of user_id containing the users to filter the results to
+ * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant)
+ * @var array ex_fid_ary Which forums not to search on
+ * @var int topic_id Limit the search to this topic_id only
+ * @var string sql_sort_table Extra tables to include in the SQL query.
+ * Used in conjunction with sql_sort_join
+ * @var string sql_sort_join SQL conditions to join all the tables used together.
+ * Used in conjunction with sql_sort_table
+ * @var int sort_days Time, in days, of the oldest possible post to list
+ * @var string sql_where An array of the current WHERE clause conditions
+ * @var string sql_match Which columns to do the search on
+ * @var string sql_match_where Extra conditions to use to properly filter the matching process
+ * @var string group_by Whether or not the SQL query requires a GROUP BY for the elements in the SELECT clause
+ * @var string sort_by_sql The possible predefined sort types
+ * @var string sort_key The sort type used from the possible sort types
+ * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used
+ * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir
+ * @var int start How many posts to skip in the search results (used for pagination)
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'search_query',
+ 'must_not_contain_ids',
+ 'must_exclude_one_ids',
+ 'must_contain_ids',
+ 'result_count',
+ 'join_topic',
+ 'author_ary',
+ 'author_name',
+ 'ex_fid_ary',
+ 'topic_id',
+ 'sql_sort_table',
+ 'sql_sort_join',
+ 'sort_days',
+ 'sql_where',
+ 'sql_match',
+ 'sql_match_where',
+ 'group_by',
+ 'sort_by_sql',
+ 'sort_key',
+ 'sort_dir',
+ 'sql_sort',
+ 'start',
+ );
+ extract($this->phpbb_dispatcher->trigger_event('core.search_native_keywords_count_query_before', compact($vars)));
+
if ($topic_id)
{
$sql_where[] = 'p.topic_id = ' . $topic_id;
@@ -831,6 +893,13 @@ class fulltext_native extends \phpbb\search\base
);
}
+ // if using mysql and the total result count is not calculated yet, get it from the db
+ if (!$total_results && $is_mysql)
+ {
+ // Also count rows for the query as if there was not LIMIT. Add SQL_CALC_FOUND_ROWS to SQL
+ $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT'];
+ }
+
$sql_array['WHERE'] = implode(' AND ', $sql_where);
$sql_array['GROUP_BY'] = ($group_by) ? (($type == 'posts') ? 'p.post_id' : 'p.topic_id') . ', ' . $sort_by_sql[$sort_key] : '';
$sql_array['ORDER_BY'] = $sql_sort;
@@ -846,19 +915,9 @@ class fulltext_native extends \phpbb\search\base
}
$this->db->sql_freeresult($result);
- // if we use mysql and the total result count is not cached yet, retrieve it from the db
if (!$total_results && $is_mysql)
{
- // Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it
- $sql_array_copy = $sql_array;
- $sql_array_copy['SELECT'] = 'SQL_CALC_FOUND_ROWS p.post_id ';
-
- $sql_calc = $this->db->sql_build_query('SELECT', $sql_array_copy);
- unset($sql_array_copy);
-
- $this->db->sql_query($sql_calc);
- $this->db->sql_freeresult($result);
-
+ // Get the number of results as calculated by MySQL
$sql_count = 'SELECT FOUND_ROWS() as total_results';
$result = $this->db->sql_query($sql_count);
$total_results = (int) $this->db->sql_fetchfield('total_results');
@@ -983,6 +1042,49 @@ class fulltext_native extends \phpbb\search\base
$select = ($type == 'posts') ? 'p.post_id' : 't.topic_id';
$is_mysql = false;
+ /**
+ * Allow changing the query used to search for posts by author in fulltext_native
+ *
+ * @event core.search_native_author_count_query_before
+ * @var int total_results The previous result count for the format of the query.
+ * Set to 0 to force a re-count
+ * @var string select SQL SELECT clause for what to get
+ * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen
+ * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table
+ * @var array sql_author SQL WHERE condition for the post author ids
+ * @var int topic_id Limit the search to this topic_id only
+ * @var string sort_by_sql The possible predefined sort types
+ * @var string sort_key The sort type used from the possible sort types
+ * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used
+ * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir
+ * @var string sort_days Time, in days, that the oldest post showing can have
+ * @var string sql_time The SQL to search on the time specifyed by sort_days
+ * @var bool firstpost_only Wether or not to search only on the first post of the topics
+ * @var array ex_fid_ary Forum ids that must not be searched on
+ * @var array sql_fora SQL query for ex_fid_ary
+ * @var int start How many posts to skip in the search results (used for pagination)
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'total_results',
+ 'select',
+ 'sql_sort_table',
+ 'sql_sort_join',
+ 'sql_author',
+ 'topic_id',
+ 'sort_by_sql',
+ 'sort_key',
+ 'sort_dir',
+ 'sql_sort',
+ 'sort_days',
+ 'sql_time',
+ 'firstpost_only',
+ 'ex_fid_ary',
+ 'sql_fora',
+ 'start',
+ );
+ extract($this->phpbb_dispatcher->trigger_event('core.search_native_author_count_query_before', compact($vars)));
+
// If the cache was completely empty count the results
if (!$total_results)
{
@@ -1086,7 +1188,7 @@ class fulltext_native extends \phpbb\search\base
// Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it.
$sql_calc = str_replace('SELECT ' . $select, 'SELECT DISTINCT SQL_CALC_FOUND_ROWS p.post_id', $sql);
- $this->db->sql_query($sql_calc);
+ $result = $this->db->sql_query($sql_calc);
$this->db->sql_freeresult($result);
$sql_count = 'SELECT FOUND_ROWS() as total_results';
diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php
index ff9a359b95..d17b26be8f 100644
--- a/phpBB/phpbb/search/fulltext_postgres.php
+++ b/phpBB/phpbb/search/fulltext_postgres.php
@@ -56,7 +56,7 @@ class fulltext_postgres extends \phpbb\search\base
protected $db;
/**
- * PhpBB event dispatcher object
+ * phpBB event dispatcher object
* @var \phpbb\event\dispatcher_interface
*/
protected $phpbb_dispatcher;
@@ -97,10 +97,10 @@ class fulltext_postgres extends \phpbb\search\base
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\config\config $config Config object
* @param \phpbb\db\driver\driver_interface Database object
- * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
* @param \phpbb\user $user User object
+ * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
*/
- public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user)
+ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher)
{
$this->config = $config;
$this->db = $db;
@@ -417,6 +417,55 @@ class fulltext_postgres extends \phpbb\search\base
break;
}
+ $tsearch_query = $this->tsearch_query;
+
+ /**
+ * Allow changing the query used to search for posts using fulltext_postgres
+ *
+ * @event core.search_postgres_keywords_main_query_before
+ * @var string tsearch_query The parsed keywords used for this search
+ * @var int result_count The previous result count for the format of the query.
+ * Set to 0 to force a re-count
+ * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED
+ * @var array author_ary Array of user_id containing the users to filter the results to
+ * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant)
+ * @var array ex_fid_ary Which forums not to search on
+ * @var int topic_id Limit the search to this topic_id only
+ * @var string sql_sort_table Extra tables to include in the SQL query.
+ * Used in conjunction with sql_sort_join
+ * @var string sql_sort_join SQL conditions to join all the tables used together.
+ * Used in conjunction with sql_sort_table
+ * @var int sort_days Time, in days, of the oldest possible post to list
+ * @var string sql_match Which columns to do the search on.
+ * @var string sql_match_where Extra conditions to use to properly filter the matching process
+ * @var string sort_by_sql The possible predefined sort types
+ * @var string sort_key The sort type used from the possible sort types
+ * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used
+ * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir
+ * @var int start How many posts to skip in the search results (used for pagination)
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'tsearch_query',
+ 'result_count',
+ 'join_topic',
+ 'author_ary',
+ 'author_name',
+ 'ex_fid_ary',
+ 'topic_id',
+ 'sql_sort_table',
+ 'sql_sort_join',
+ 'sort_days',
+ 'sql_match',
+ 'sql_match_where',
+ 'sort_by_sql',
+ 'sort_key',
+ 'sort_dir',
+ 'sql_sort',
+ 'start',
+ );
+ extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_keywords_main_query_before', compact($vars)));
+
$sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id';
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
$field = ($type == 'posts') ? 'post_id' : 'topic_id';
diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
index a09f5cbbe5..fddd1c39d1 100644
--- a/phpBB/phpbb/search/fulltext_sphinx.php
+++ b/phpBB/phpbb/search/fulltext_sphinx.php
@@ -96,7 +96,7 @@ class fulltext_sphinx
protected $dbtype;
/**
- * PhpBB event dispatcher object
+ * phpBB event dispatcher object
* @var \phpbb\event\dispatcher_interface
*/
protected $phpbb_dispatcher;
@@ -130,10 +130,10 @@ class fulltext_sphinx
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\config\config $config Config object
* @param \phpbb\db\driver\driver_interface Database object
- * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
* @param \phpbb\user $user User object
+ * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
*/
- public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user)
+ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php
index 2f8ffaa776..139a413b70 100644
--- a/phpBB/phpbb/template/twig/loader.php
+++ b/phpBB/phpbb/template/twig/loader.php
@@ -97,7 +97,8 @@ class loader extends \Twig_Loader_Filesystem
// If this is in the cache we can skip the entire process below
// as it should have already been validated
- if (isset($this->cache[$name])) {
+ if (isset($this->cache[$name]))
+ {
return $this->cache[$name];
}
diff --git a/phpBB/phpbb/template/twig/node/definenode.php b/phpBB/phpbb/template/twig/node/definenode.php
index 695ec4281f..ddbd151d20 100644
--- a/phpBB/phpbb/template/twig/node/definenode.php
+++ b/phpBB/phpbb/template/twig/node/definenode.php
@@ -14,7 +14,6 @@
namespace phpbb\template\twig\node;
-
class definenode extends \Twig_Node
{
public function __construct($capture, \Twig_NodeInterface $name, \Twig_NodeInterface $value, $lineno, $tag = null)
@@ -31,7 +30,8 @@ class definenode extends \Twig_Node
{
$compiler->addDebugInfo($this);
- if ($this->getAttribute('capture')) {
+ if ($this->getAttribute('capture'))
+ {
$compiler
->write("ob_start();\n")
->subcompile($this->getNode('value'))
diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php
index 8fc4ba4775..b765bde98d 100644
--- a/phpBB/phpbb/template/twig/node/event.php
+++ b/phpBB/phpbb/template/twig/node/event.php
@@ -13,7 +13,6 @@
namespace phpbb\template\twig\node;
-
class event extends \Twig_Node
{
/**
diff --git a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
index 8c7f7b378d..2cd15d59da 100644
--- a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
+++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
@@ -13,7 +13,6 @@
namespace phpbb\template\twig\node\expression\binary;
-
class equalequal extends \Twig_Node_Expression_Binary
{
public function operator(\Twig_Compiler $compiler)
diff --git a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
index 2e95c68090..5f2908fb9b 100644
--- a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
+++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
@@ -13,7 +13,6 @@
namespace phpbb\template\twig\node\expression\binary;
-
class notequalequal extends \Twig_Node_Expression_Binary
{
public function operator(\Twig_Compiler $compiler)
diff --git a/phpBB/phpbb/template/twig/node/includenode.php b/phpBB/phpbb/template/twig/node/includenode.php
index 42428b6106..c36ac3c324 100644
--- a/phpBB/phpbb/template/twig/node/includenode.php
+++ b/phpBB/phpbb/template/twig/node/includenode.php
@@ -13,7 +13,6 @@
namespace phpbb\template\twig\node;
-
class includenode extends \Twig_Node_Include
{
/**
diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php
index 826617e8e8..76182c2f84 100644
--- a/phpBB/phpbb/template/twig/node/includephp.php
+++ b/phpBB/phpbb/template/twig/node/includephp.php
@@ -14,7 +14,6 @@
namespace phpbb\template\twig\node;
-
class includephp extends \Twig_Node
{
/** @var \Twig_Environment */
@@ -47,7 +46,8 @@ class includephp extends \Twig_Node
return;
}
- if ($this->getAttribute('ignore_missing')) {
+ if ($this->getAttribute('ignore_missing'))
+ {
$compiler
->write("try {\n")
->indent()
@@ -76,7 +76,8 @@ class includephp extends \Twig_Node
->write("}\n")
;
- if ($this->getAttribute('ignore_missing')) {
+ if ($this->getAttribute('ignore_missing'))
+ {
$compiler
->outdent()
->write("} catch (\Twig_Error_Loader \$e) {\n")
diff --git a/phpBB/phpbb/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php
index 3a24513dca..4ee415e446 100644
--- a/phpBB/phpbb/template/twig/node/php.php
+++ b/phpBB/phpbb/template/twig/node/php.php
@@ -13,7 +13,6 @@
namespace phpbb\template\twig\node;
-
class php extends \Twig_Node
{
/** @var \Twig_Environment */
diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
index cfee84a363..b755836ccd 100644
--- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php
+++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
@@ -14,7 +14,6 @@
namespace phpbb\template\twig\tokenparser;
-
class defineparser extends \Twig_TokenParser
{
/**
@@ -33,7 +32,8 @@ class defineparser extends \Twig_TokenParser
$name = $this->parser->getExpressionParser()->parseExpression();
$capture = false;
- if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) {
+ if ($stream->test(\Twig_Token::OPERATOR_TYPE, '='))
+ {
$stream->next();
$value = $this->parser->getExpressionParser()->parseExpression();
@@ -45,7 +45,9 @@ class defineparser extends \Twig_TokenParser
}
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
- } else {
+ }
+ else
+ {
$capture = true;
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
diff --git a/phpBB/phpbb/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php
index 4c7c8e07d9..f73ef4ae25 100644
--- a/phpBB/phpbb/template/twig/tokenparser/event.php
+++ b/phpBB/phpbb/template/twig/tokenparser/event.php
@@ -13,7 +13,6 @@
namespace phpbb\template\twig\tokenparser;
-
class event extends \Twig_TokenParser
{
/**
diff --git a/phpBB/phpbb/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php
index 4156048e42..4b67d2c468 100644
--- a/phpBB/phpbb/template/twig/tokenparser/includejs.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php
@@ -13,7 +13,6 @@
namespace phpbb\template\twig\tokenparser;
-
class includejs extends \Twig_TokenParser
{
/**
diff --git a/phpBB/phpbb/template/twig/tokenparser/includeparser.php b/phpBB/phpbb/template/twig/tokenparser/includeparser.php
index 6ee78e5562..aa7236aaa6 100644
--- a/phpBB/phpbb/template/twig/tokenparser/includeparser.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php
@@ -14,7 +14,6 @@
namespace phpbb\template\twig\tokenparser;
-
class includeparser extends \Twig_TokenParser_Include
{
/**
diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php
index 38196c5290..3992636f8c 100644
--- a/phpBB/phpbb/template/twig/tokenparser/includephp.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php
@@ -14,7 +14,6 @@
namespace phpbb\template\twig\tokenparser;
-
class includephp extends \Twig_TokenParser
{
/**
@@ -31,7 +30,8 @@ class includephp extends \Twig_TokenParser
$stream = $this->parser->getStream();
$ignoreMissing = false;
- if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) {
+ if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore'))
+ {
$stream->next();
$stream->expect(\Twig_Token::NAME_TYPE, 'missing');
diff --git a/phpBB/phpbb/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php
index 557a70cca1..f11ce35896 100644
--- a/phpBB/phpbb/template/twig/tokenparser/php.php
+++ b/phpBB/phpbb/template/twig/tokenparser/php.php
@@ -13,7 +13,6 @@
namespace phpbb\template\twig\tokenparser;
-
class php extends \Twig_TokenParser
{
/**
diff --git a/phpBB/posting.php b/phpBB/posting.php
index ac412c0c73..7e3611c368 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -35,7 +35,6 @@ $forum_id = request_var('f', 0);
$draft_id = request_var('d', 0);
$lastclick = request_var('lastclick', 0);
-$submit = (isset($_POST['post'])) ? true : false;
$preview = (isset($_POST['preview'])) ? true : false;
$save = (isset($_POST['save'])) ? true : false;
$load = (isset($_POST['load'])) ? true : false;
@@ -43,6 +42,7 @@ $confirm = $request->is_set_post('confirm');
$cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false;
$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview);
+$submit = $request->is_set_post('post') && !$refresh && !$preview;
$mode = request_var('mode', '');
// If the user is not allowed to delete the post, we try to soft delete it, so we overwrite the mode here.
@@ -330,14 +330,17 @@ switch ($mode)
{
$is_authed = true;
}
- break;
+
+ // no break;
case 'soft_delete':
- if ($user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked']))
+ if (!$is_authed && $user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked']))
{
+ // Fall back to soft_delete if we have no permissions to delete posts but to soft delete them
$is_authed = true;
+ $mode = 'soft_delete';
}
- else
+ else if (!$is_authed)
{
// Display the same error message for softdelete we use for delete
$mode = 'delete';
@@ -1238,6 +1241,7 @@ if ($submit || $preview || $refresh)
*
* @event core.posting_modify_submission_errors
* @var array post_data Array with post data
+ * @var array poll Array with poll data from post (must be used instead of the post_data equivalent)
* @var string mode What action to take if the form is submitted
* post|reply|quote|edit|delete|bump|smilies|popup
* @var string page_title Title of the mode page
@@ -1248,9 +1252,11 @@ if ($submit || $preview || $refresh)
* @var array error Any error strings; a non-empty array aborts form submission.
* NOTE: Should be actual language strings, NOT language keys.
* @since 3.1.0-RC5
+ * @change 3.1.5-RC1 Added poll array to the event
*/
$vars = array(
'post_data',
+ 'poll',
'mode',
'page_title',
'post_id',
@@ -1517,9 +1523,13 @@ if (!sizeof($error) && $preview)
'L_MAX_VOTES' => $user->lang('MAX_OPTIONS_SELECT', (int) $post_data['poll_max_options']),
));
- $parse_poll->message = implode("\n", $post_data['poll_options']);
- $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']);
- $preview_poll_options = explode('<br />', $parse_poll->message);
+ $preview_poll_options = array();
+ foreach ($post_data['poll_options'] as $poll_option)
+ {
+ $parse_poll->message = $poll_option;
+ $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']);
+ $preview_poll_options[] = $parse_poll->message;
+ }
unset($parse_poll);
foreach ($preview_poll_options as $key => $option)
@@ -1784,6 +1794,30 @@ $page_data = array(
'S_IN_POSTING' => true,
);
+// Build custom bbcodes array
+display_custom_bbcodes();
+
+// Poll entry
+if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/))
+ && $auth->acl_get('f_poll', $forum_id))
+{
+ $page_data = array_merge($page_data, array(
+ 'S_SHOW_POLL_BOX' => true,
+ 'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)),
+ 'S_POLL_DELETE' => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
+ 'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false,
+
+ 'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']),
+
+ 'VOTE_CHANGE_CHECKED' => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '',
+ 'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '',
+ 'POLL_OPTIONS' => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '',
+ 'POLL_MAX_OPTIONS' => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1,
+ 'POLL_LENGTH' => $post_data['poll_length'],
+ )
+ );
+}
+
/**
* This event allows you to modify template variables for the posting screen
*
@@ -1822,6 +1856,7 @@ $page_data = array(
* post_id, topic_id, forum_id, submit, preview, save, load,
* delete, cancel, refresh, error, page_data, message_parser
* @change 3.1.2-RC1 Removed 'delete' var as it does not exist
+* @change 3.1.5-RC1 Added poll variables to the page_data array
*/
$vars = array(
'post_data',
@@ -1850,29 +1885,6 @@ extract($phpbb_dispatcher->trigger_event('core.posting_modify_template_vars', co
// Start assigning vars for main posting page ...
$template->assign_vars($page_data);
-// Build custom bbcodes array
-display_custom_bbcodes();
-
-// Poll entry
-if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/))
- && $auth->acl_get('f_poll', $forum_id))
-{
- $template->assign_vars(array(
- 'S_SHOW_POLL_BOX' => true,
- 'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)),
- 'S_POLL_DELETE' => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
- 'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false,
-
- 'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']),
-
- 'VOTE_CHANGE_CHECKED' => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '',
- 'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '',
- 'POLL_OPTIONS' => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '',
- 'POLL_MAX_OPTIONS' => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1,
- 'POLL_LENGTH' => $post_data['poll_length'])
- );
-}
-
// Show attachment box for adding attachments if true
$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype);
diff --git a/phpBB/search.php b/phpBB/search.php
index d4349f4bf6..70b7de139d 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -274,7 +274,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
}
// We do some additional checks in the module to ensure it can actually be utilised
$error = false;
- $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $phpbb_dispatcher, $user);
+ $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
if ($error)
{
diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg
index 34a7618f86..b39dac079a 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.3
-phpbb_version = 3.1.3
+style_version = 3.1.4
+phpbb_version = 3.1.4
# 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 168efff4b4..76c605dd19 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -9,9 +9,9 @@ phpbb.addAjaxCallback('mark_forums_read', function(res) {
var readTitle = res.NO_UNREAD_POSTS;
var unreadTitle = res.UNREAD_POSTS;
var iconsArray = {
- 'forum_unread': 'forum_read',
- 'forum_unread_subforum': 'forum_read_subforum',
- 'forum_unread_locked': 'forum_read_locked'
+ forum_unread: 'forum_read',
+ forum_unread_subforum: 'forum_read_subforum',
+ forum_unread_locked: 'forum_read_locked'
};
$('li.row').find('dl[class*="forum_unread"]').each(function() {
@@ -39,20 +39,20 @@ phpbb.addAjaxCallback('mark_forums_read', function(res) {
phpbb.closeDarkenWrapper(3000);
});
-/**
+/**
* This callback will mark all topic icons read
*
-* @param update_topic_links bool Whether "Mark topics read" links should be
-* updated. Defaults to true.
+* @param {bool} [update_topic_links=true] Whether "Mark topics read" links
+* should be updated. Defaults to true.
*/
phpbb.addAjaxCallback('mark_topics_read', function(res, updateTopicLinks) {
var readTitle = res.NO_UNREAD_POSTS;
var unreadTitle = res.UNREAD_POSTS;
var iconsArray = {
- 'global_unread': 'global_read',
- 'announce_unread': 'announce_read',
- 'sticky_unread': 'sticky_read',
- 'topic_unread': 'topic_read'
+ global_unread: 'global_read',
+ announce_unread: 'announce_read',
+ sticky_unread: 'sticky_read',
+ topic_unread: 'topic_read'
};
var iconsState = ['', '_hot', '_hot_mine', '_locked', '_locked_mine', '_mine'];
var unreadClassSelectors;
@@ -138,9 +138,9 @@ phpbb.markNotifications = function($popup, unreadCount) {
}
// Update page title
- $('title').text(
- (unreadCount ? '(' + unreadCount + ')' : '') + $('title').text().replace(/(\(([0-9])\))/, '')
- );
+ var $title = $('title');
+ var originalTitle = $title.text().replace(/(\((\d+)\))/, '');
+ $title.text((unreadCount ? '(' + unreadCount + ')' : '') + originalTitle);
};
// This callback finds the post from the delete link, and removes it.
@@ -205,7 +205,7 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
// Set min-height to prevent the page from jumping when the content changes
var updatePanelHeight = function (height) {
- var height = (typeof height === 'undefined') ? panel.find('.inner').outerHeight() : height;
+ height = (typeof height === 'undefined') ? panel.find('.inner').outerHeight() : height;
panel.css('min-height', height);
};
updatePanelHeight();
@@ -223,7 +223,7 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
// If the user can still vote, simply slide down the results
poll.find('.resultbar, .poll_option_percent, .poll_total_votes').show(500);
}
-
+
// Get the votes count of the highest poll option
poll.find('[data-poll-option-id]').each(function() {
var option = $(this);
@@ -252,7 +252,7 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
var newBarClass = (percent === 100) ? 'pollbar5' : 'pollbar' + (Math.floor(percent / 20) + 1);
setTimeout(function () {
- bar.animate({width: percentRel + '%'}, 500)
+ bar.animate({ width: percentRel + '%' }, 500)
.removeClass('pollbar1 pollbar2 pollbar3 pollbar4 pollbar5')
.addClass(newBarClass)
.html(res.vote_counts[optionId]);
@@ -287,10 +287,10 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
var panelHeight = panel.height();
var innerHeight = panel.find('.inner').outerHeight();
- if (panelHeight != innerHeight) {
- panel.css({'min-height': '', 'height': panelHeight})
- .animate({height: innerHeight}, time, function () {
- panel.css({'min-height': innerHeight, 'height': ''});
+ if (panelHeight !== innerHeight) {
+ panel.css({ minHeight: '', height: panelHeight })
+ .animate({ height: innerHeight }, time, function () {
+ panel.css({ minHeight: innerHeight, height: '' });
});
}
};
@@ -377,8 +377,9 @@ $('#member_search').click(function () {
* Automatically resize textarea
*/
$(function() {
- phpbb.resizeTextArea($('textarea:not(#message-box textarea, .no-auto-resize)'), {minHeight: 75, maxHeight: 250});
- phpbb.resizeTextArea($('#message-box textarea'));
+ var $textarea = $('textarea:not(#message-box textarea, .no-auto-resize)');
+ phpbb.resizeTextArea($textarea, { minHeight: 75, maxHeight: 250 });
+ phpbb.resizeTextArea($('textarea', '#message-box'));
});
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js
index aabc5679f6..ccedf19604 100644
--- a/phpBB/styles/prosilver/template/forum_fn.js
+++ b/phpBB/styles/prosilver/template/forum_fn.js
@@ -1,3 +1,5 @@
+/* global phpbb */
+
/**
* phpBB3 forum functions
*/
@@ -37,7 +39,7 @@ function pageJump(item) {
baseUrl = item.attr('data-base-url'),
startName = item.attr('data-start-name');
- if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) {
+ if (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0) {
if (baseUrl.indexOf('?') === -1) {
document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage);
} else {
@@ -124,7 +126,7 @@ function activateSubPanel(p, panels) {
var i, showPanel;
- if (typeof(p) === 'string') {
+ if (typeof p === 'string') {
showPanel = p;
}
$('input[name="show_panel"]').val(showPanel);
@@ -277,8 +279,7 @@ jQuery(function($) {
/**
* Functions for user search popup
*/
-function insertUser(formId, value)
-{
+function insertUser(formId, value) {
'use strict';
var $form = jQuery(formId),
@@ -286,7 +287,7 @@ function insertUser(formId, value)
fieldName = $form.attr('data-field-name'),
item = opener.document.forms[formName][fieldName];
- if (item.value.length && item.type == 'textarea') {
+ if (item.value.length && item.type === 'textarea') {
value = item.value + '\n' + value;
}
@@ -319,7 +320,7 @@ function parseDocument($container) {
'use strict';
var test = document.createElement('div'),
- oldBrowser = (typeof test.style.borderRadius == 'undefined'),
+ oldBrowser = (typeof test.style.borderRadius === 'undefined'),
$body = $('body');
/**
@@ -359,7 +360,10 @@ function parseDocument($container) {
*/
if (oldBrowser) {
// Fix .linklist.bulletin lists
- $container.find('ul.linklist.bulletin > li:first-child, ul.linklist.bulletin > li.rightside:last-child').addClass('no-bulletin');
+ $container
+ .find('ul.linklist.bulletin > li')
+ .filter(':first-child, .rightside:last-child')
+ .addClass('no-bulletin');
}
/**
@@ -376,12 +380,19 @@ function parseDocument($container) {
function resize() {
var width = 0,
- diff = $left.outerWidth(true) - $left.width();
+ diff = $left.outerWidth(true) - $left.width(),
+ minWidth = Math.max($this.width() / 3, 240),
+ maxWidth;
$right.each(function() {
- width += $(this).outerWidth(true);
+ var $this = $(this);
+ if ($this.is(':visible')) {
+ width += $this.outerWidth(true);
+ }
});
- $left.css('max-width', Math.floor($this.width() - width - diff) + 'px');
+
+ maxWidth = $this.width() - width - diff;
+ $left.css('max-width', Math.floor(Math.max(maxWidth, minWidth)) + 'px');
}
resize();
@@ -410,9 +421,15 @@ function parseDocument($container) {
// Function that checks breadcrumbs
function check() {
var height = $this.height(),
+ width;
+
+ // Test max-width set in code for .navlinks above
+ width = parseInt($this.css('max-width'), 10);
+ if (!width) {
width = $body.width();
+ }
- maxHeight = parseInt($this.css('line-height'));
+ maxHeight = parseInt($this.css('line-height'), 10);
$links.each(function() {
if ($(this).height() > 0) {
maxHeight = Math.max(maxHeight, $(this).outerHeight(true));
@@ -439,8 +456,8 @@ function parseDocument($container) {
return;
}
- for (var i = 0; i < classesLength; i ++) {
- for (var j = length - 1; j >= 0; j --) {
+ for (var i = 0; i < classesLength; i++) {
+ for (var j = length - 1; j >= 0; j--) {
$links.eq(j).addClass('wrapped ' + classes[i]);
if ($this.height() <= maxHeight) {
return;
@@ -457,7 +474,9 @@ function parseDocument($container) {
/**
* Responsive link lists
*/
- $container.find('.linklist:not(.navlinks, [data-skip-responsive]), .postbody .post-buttons:not([data-skip-responsive])').each(function() {
+ var selector = '.linklist:not(.navlinks, [data-skip-responsive]),' +
+ '.postbody .post-buttons:not([data-skip-responsive])';
+ $container.find(selector).each(function() {
var $this = $(this),
filterSkip = '.breadcrumbs, [data-skip-responsive]',
filterLast = '.edit-icon, .quote-icon, [data-last-responsive]',
@@ -465,7 +484,7 @@ function parseDocument($container) {
$linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden
$linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first
$linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last
- persistent = $this.attr('id') == 'nav-main', // Does this list already have a menu (such as quick-links)?
+ persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)?
html = '<li class="responsive-menu hidden"><a href="javascript:void(0);" class="responsive-menu-link">&nbsp;</a><div class="dropdown hidden"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>',
slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured.
@@ -662,7 +681,7 @@ function parseDocument($container) {
$children = column.children(),
html = column.html();
- if ($children.length == 1 && $children.text() == column.text()) {
+ if ($children.length === 1 && $children.text() === column.text()) {
html = $children.html();
}
@@ -704,8 +723,7 @@ function parseDocument($container) {
if (!$block.length) {
$this.find('dt > .list-inner').append('<div class="responsive-show" style="display:none;" />');
$block = $this.find('dt .responsive-show:last-child');
- }
- else {
+ } else {
first = ($.trim($block.text()).length === 0);
}
@@ -715,7 +733,7 @@ function parseDocument($container) {
children = column.children(),
html = column.html();
- if (children.length == 1 && children.text() == column.text()) {
+ if (children.length === 1 && children.text() === column.text()) {
html = children.html();
}
@@ -744,7 +762,7 @@ function parseDocument($container) {
// Find each header
$th.each(function(column) {
var cell = $(this),
- colspan = parseInt(cell.attr('colspan')),
+ colspan = parseInt(cell.attr('colspan'), 10),
dfn = cell.attr('data-dfn'),
text = dfn ? dfn : cell.text();
@@ -775,14 +793,14 @@ function parseDocument($container) {
cells = row.children('td'),
column = 0;
- if (cells.length == 1) {
+ if (cells.length === 1) {
row.addClass('big-column');
return;
}
cells.each(function() {
var cell = $(this),
- colspan = parseInt(cell.attr('colspan')),
+ colspan = parseInt(cell.attr('colspan'), 10),
text = $.trim(cell.text());
if (headersLength <= column) {
@@ -858,19 +876,26 @@ function parseDocument($container) {
total = $availableTabs.length,
i, $tab;
- for (i = total - 1; i >= 0; i --) {
+ for (i = total - 1; i >= 0; i--) {
$tab = $availableTabs.eq(i);
$menu.prepend($tab.clone(true).removeClass('tab'));
$tab.hide();
if ($this.height() <= maxHeight) {
- $menu.find('a').click(function() { check(true); });
+ $menu.find('a').click(function() {
+ check(true);
+ });
return;
}
}
- $menu.find('a').click(function() { check(true); });
+ $menu.find('a').click(function() {
+ check(true);
+ });
}
- phpbb.registerDropdown($item.find('a.responsive-tab-link'), $item.find('.dropdown'), {visibleClass: 'activetab'});
+ var $tabLink = $item.find('a.responsive-tab-link');
+ phpbb.registerDropdown($tabLink, $item.find('.dropdown'), {
+ visibleClass: 'activetab'
+ });
check(true);
$(window).resize(check);
diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html
index f2e03630ff..f8d6e36c8c 100644
--- a/phpBB/styles/prosilver/template/forumlist_body.html
+++ b/phpBB/styles/prosilver/template/forumlist_body.html
@@ -13,12 +13,14 @@
<div class="inner">
<ul class="topiclist">
<li class="header">
+ <!-- EVENT forumlist_body_category_header_row_prepend -->
<dl class="icon">
<dt><div class="list-inner"><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></div></dt>
<dd class="topics">{L_TOPICS}</dd>
<dd class="posts">{L_POSTS}</dd>
<dd class="lastpost"><span>{L_LAST_POST}</span></dd>
</dl>
+ <!-- EVENT forumlist_body_category_header_row_append -->
</li>
</ul>
<ul class="topiclist forums">
diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html
index f620b6e966..ec5bf35476 100644
--- a/phpBB/styles/prosilver/template/index_body.html
+++ b/phpBB/styles/prosilver/template/index_body.html
@@ -19,15 +19,15 @@
<form method="post" action="{S_LOGIN_ACTION}" class="headerspace">
<h3><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a><!-- IF S_REGISTER_ENABLED -->&nbsp; &bull; &nbsp;<a href="{U_REGISTER}">{L_REGISTER}</a><!-- ENDIF --></h3>
<fieldset class="quick-login">
- <label for="username"><span>{L_USERNAME}{L_COLON}</span> <input type="text" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" /></label>
- <label for="password"><span>{L_PASSWORD}{L_COLON}</span> <input type="password" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" /></label>
+ <label for="username"><span>{L_USERNAME}{L_COLON}</span> <input type="text" tabindex="1" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" /></label>
+ <label for="password"><span>{L_PASSWORD}{L_COLON}</span> <input type="password" tabindex="2" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" autocomplete="off" /></label>
<!-- IF U_SEND_PASSWORD -->
<a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a>
<!-- ENDIF -->
<!-- IF S_AUTOLOGIN_ENABLED -->
- <span class="responsive-hide">|</span> <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" name="autologin" id="autologin" /></label>
+ <span class="responsive-hide">|</span> <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" tabindex="4" name="autologin" id="autologin" /></label>
<!-- ENDIF -->
- <input type="submit" name="login" value="{L_LOGIN}" class="button2" />
+ <input type="submit" tabindex="5" name="login" value="{L_LOGIN}" class="button2" />
{S_LOGIN_REDIRECT}
</fieldset>
</form>
diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html
index c852ffd5f2..ef08035717 100644
--- a/phpBB/styles/prosilver/template/login_body.html
+++ b/phpBB/styles/prosilver/template/login_body.html
@@ -15,7 +15,7 @@
</dl>
<dl>
<dt><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}{L_COLON}</label></dt>
- <dd><input type="password" tabindex="2" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" /></dd>
+ <dd><input type="password" tabindex="2" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" autocomplete="off" /></dd>
<!-- IF S_DISPLAY_FULL_LOGIN and (U_SEND_PASSWORD or U_RESEND_ACTIVATION) -->
<!-- IF U_SEND_PASSWORD --><dd><a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a></dd><!-- ENDIF -->
<!-- IF U_RESEND_ACTIVATION --><dd><a href="{U_RESEND_ACTIVATION}">{L_RESEND_ACTIVATION}</a></dd><!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/login_forum.html b/phpBB/styles/prosilver/template/login_forum.html
index 18a95c0a8f..7fa9736a96 100644
--- a/phpBB/styles/prosilver/template/login_forum.html
+++ b/phpBB/styles/prosilver/template/login_forum.html
@@ -22,7 +22,7 @@
<dl>
<dt><label for="password">{L_PASSWORD}{L_COLON}</label></dt>
- <dd><input type="password" tabindex="1" id="password" name="password" size="25" class="inputbox narrow" /></dd>
+ <dd><input type="password" tabindex="1" id="password" name="password" size="25" class="inputbox narrow" autocomplete="off" /></dd>
</dl>
{S_LOGIN_REDIRECT}
<dl>
diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html
index 10ec6f3ea9..81d1be795e 100644
--- a/phpBB/styles/prosilver/template/mcp_post.html
+++ b/phpBB/styles/prosilver/template/mcp_post.html
@@ -144,7 +144,7 @@
</div>
</div>
-<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER -->
+<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER or S_MCP_POST_ADDITIONAL_OPTS -->
<div class="panel">
<div class="inner">
@@ -168,6 +168,8 @@
</form>
<!-- ENDIF -->
+ <!-- EVENT mcp_post_additional_options -->
+
<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST -->
<form method="post" id="mcp" action="{U_MCP_ACTION}">
diff --git a/phpBB/styles/prosilver/template/memberlist_email.html b/phpBB/styles/prosilver/template/memberlist_email.html
index 1bfd83e3a1..4a9f764d07 100644
--- a/phpBB/styles/prosilver/template/memberlist_email.html
+++ b/phpBB/styles/prosilver/template/memberlist_email.html
@@ -40,21 +40,21 @@
</dl>
<!-- ELSEIF S_CONTACT_ADMIN-->
<dl>
- <dt><label>{L_RECIPIENT}:</label></dt>
+ <dt><label>{L_RECIPIENT}{L_COLON}</label></dt>
<dd><strong>{L_ADMINISTRATOR}</strong></dd>
</dl>
<!-- IF not S_IS_REGISTERED -->
<dl>
- <dt><label for="email">{L_SENDER_EMAIL_ADDRESS}:</label></dt>
+ <dt><label for="email">{L_SENDER_EMAIL_ADDRESS}{L_COLON}</label></dt>
<dd><input class="inputbox autowidth" type="text" name="email" id="email" size="50" maxlength="100" tabindex="1" value="{EMAIL}" /></dd>
</dl>
<dl>
- <dt><label for="name">{L_SENDER_NAME}:</label></dt>
+ <dt><label for="name">{L_SENDER_NAME}{L_COLON}</label></dt>
<dd><input class="inputbox autowidth" type="text" name="name" id="name" size="50" tabindex="2" value="{NAME}" /></dd>
</dl>
<!-- ENDIF -->
<dl>
- <dt><label for="subject">{L_SUBJECT}:</label></dt>
+ <dt><label for="subject">{L_SUBJECT}{L_COLON}</label></dt>
<dd><input class="inputbox autowidth" type="text" name="subject" id="subject" size="50" tabindex="3" value="{SUBJECT}" /></dd>
</dl>
<!-- ELSE -->
diff --git a/phpBB/styles/prosilver/template/navbar_footer.html b/phpBB/styles/prosilver/template/navbar_footer.html
index 4a9275c898..b5a705d567 100644
--- a/phpBB/styles/prosilver/template/navbar_footer.html
+++ b/phpBB/styles/prosilver/template/navbar_footer.html
@@ -1,4 +1,4 @@
-<div class="navbar">
+<div class="navbar" role="navigation">
<div class="inner">
<ul id="nav-footer" class="linklist bulletin" role="menubar">
diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html
index 6f35d0e80b..ecba72f6f4 100644
--- a/phpBB/styles/prosilver/template/overall_footer.html
+++ b/phpBB/styles/prosilver/template/overall_footer.html
@@ -3,7 +3,7 @@
<!-- EVENT overall_footer_page_body_after -->
-<div id="page-footer">
+<div id="page-footer" role="contentinfo">
<!-- INCLUDE navbar_footer.html -->
<div class="copyright">
@@ -18,7 +18,6 @@
<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">&nbsp;</div>
</div>
- <div id="loading_indicator"></div>
<div id="phpbb_alert" class="phpbb_alert" data-l-err="{L_ERROR}" data-l-timeout-processing-req="{L_TIMEOUT_PROCESSING_REQ}">
<a href="#" class="alert_close"></a>
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 121094f6e0..4e2013e276 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -2,7 +2,7 @@
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
<head>
<meta charset="utf-8" />
-<meta name="viewport" content="width=device-width" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
{META}
<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title>
@@ -27,22 +27,36 @@
Modified by:
-->
-<link href="{T_THEME_PATH}/print.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="print" title="printonly" />
-<!-- IF S_ALLOW_CDN --><link href="//fonts.googleapis.com/css?family=Open+Sans:600&amp;subset=latin,cyrillic-ext,latin-ext,cyrillic,greek-ext,greek,vietnamese" rel="stylesheet" type="text/css" media="screen, projection" /><!-- ENDIF -->
-<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
-<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
-<link href="{T_THEME_PATH}/responsive.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="only screen and (max-width: 700px), only screen and (max-device-width: 700px)" />
+<!-- IF S_ALLOW_CDN -->
+<script>
+ WebFontConfig = {
+ google: {
+ families: ['Open Sans:n6']
+ }
+ };
+
+ (function(d) {
+ var wf = d.createElement('script'), s = d.scripts[0];
+ wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js';
+ wf.async = true;
+ s.parentNode.insertBefore(wf, s);
+ })(document);
+</script>
+<!-- ENDIF -->
+<link href="{T_STYLESHEET_LINK}" rel="stylesheet">
+<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet">
+<link href="{T_THEME_PATH}/responsive.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" media="all and (max-width: 700px), all and (max-device-width: 700px)" />
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
- <link href="{T_THEME_PATH}/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" />
+ <link href="{T_THEME_PATH}/bidi.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->
<!-- IF S_PLUPLOAD -->
- <link href="{T_THEME_PATH}/plupload.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" />
+ <link href="{T_THEME_PATH}/plupload.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<!-- ENDIF -->
<!--[if lte IE 9]>
- <link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="screen, projection" />
+ <link href="{T_THEME_PATH}/tweaks.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet">
<![endif]-->
<!-- EVENT overall_header_head_append -->
@@ -59,7 +73,7 @@
<div id="wrap">
<a id="top" class="anchor" accesskey="t"></a>
<div id="page-header">
- <div class="headerbar">
+ <div class="headerbar" role="banner">
<div class="inner">
<div id="site-description">
@@ -69,8 +83,9 @@
<p class="skiplink"><a href="#start_here">{L_SKIP}</a></p>
</div>
+ <!-- EVENT overall_header_searchbox_before -->
<!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH -->
- <div id="search-box" class="search-box search-header">
+ <div id="search-box" class="search-box search-header" role="search">
<form action="{U_SEARCH}" method="get" id="search">
<fieldset>
<input name="keywords" id="keywords" type="search" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search tiny" size="20" value="{SEARCH_WORDS}" placeholder="{L_SEARCH_MINI}" />
@@ -84,14 +99,14 @@
</div>
</div>
-
+ <!-- EVENT overall_header_navbar_before -->
<!-- INCLUDE navbar_header.html -->
</div>
<!-- EVENT overall_header_page_body_before -->
<a id="start_here" class="anchor"></a>
- <div id="page-body">
+ <div id="page-body" role="main">
<!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN and (U_MCP or U_ACP) -->
<div id="information" class="rules">
<div class="inner">
diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html
index e68e6a97e5..5804f95579 100644
--- a/phpBB/styles/prosilver/template/posting_editor.html
+++ b/phpBB/styles/prosilver/template/posting_editor.html
@@ -36,6 +36,7 @@
<!-- INCLUDE posting_buttons.html -->
<div id="smiley-box">
+ <!-- EVENT posting_editor_smilies_before -->
<!-- IF S_SMILIES_ALLOWED and .smiley -->
<strong>{L_SMILIES}</strong><br />
<!-- BEGIN smiley -->
@@ -45,7 +46,7 @@
<!-- IF S_SHOW_SMILEY_LINK and S_SMILIES_ALLOWED -->
<br /><a href="{U_MORE_SMILIES}" onclick="popup(this.href, 750, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a>
<!-- ENDIF -->
-
+ <!-- EVENT posting_editor_smilies_after -->
<!-- IF BBCODE_STATUS -->
<div class="bbcode-status">
<!-- IF .smiley --><hr /><!-- ENDIF -->
@@ -58,6 +59,7 @@
{SMILIES_STATUS}
</div>
<!-- ENDIF -->
+ <!-- EVENT posting_editor_bbcode_status_after -->
<!-- IF S_EDIT_DRAFT || S_DISPLAY_REVIEW -->
<!-- IF S_DISPLAY_REVIEW --><hr /><!-- ENDIF -->
<!-- IF S_EDIT_DRAFT --><strong><a href="{S_UCP_ACTION}">{L_BACK_TO_DRAFTS}</a></strong><!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/posting_pm_layout.html b/phpBB/styles/prosilver/template/posting_pm_layout.html
index 3bdadd06ca..7f4a0ea8d7 100644
--- a/phpBB/styles/prosilver/template/posting_pm_layout.html
+++ b/phpBB/styles/prosilver/template/posting_pm_layout.html
@@ -19,7 +19,9 @@
<div class="panel" id="pmheader-postingbox">
<div class="inner">
+ <!-- EVENT posting_pm_layout_include_pm_header_before -->
<!-- INCLUDE posting_pm_header.html -->
+ <!-- EVENT posting_pm_layout_include_pm_header_after -->
</div>
</div>
diff --git a/phpBB/styles/prosilver/template/posting_poll_body.html b/phpBB/styles/prosilver/template/posting_poll_body.html
index a131c10533..dcaec14a93 100644
--- a/phpBB/styles/prosilver/template/posting_poll_body.html
+++ b/phpBB/styles/prosilver/template/posting_poll_body.html
@@ -6,13 +6,14 @@
<!-- ENDIF -->
<fieldset class="fields2">
+ <!-- IF S_POLL_DELETE -->
+ <dl>
+ <dt><label for="poll_delete">{L_POLL_DELETE}{L_COLON}</label></dt>
+ <dd><label for="poll_delete"><input type="checkbox" name="poll_delete" id="poll_delete"<!-- IF S_POLL_DELETE_CHECKED --> checked="checked"<!-- ENDIF --> /> </label></dd>
+ </dl>
+ <!-- ENDIF -->
+
<!-- IF S_SHOW_POLL_BOX -->
- <!-- IF S_POLL_DELETE -->
- <dl>
- <dt><label for="poll_delete">{L_POLL_DELETE}{L_COLON}</label></dt>
- <dd><label for="poll_delete"><input type="checkbox" name="poll_delete" id="poll_delete"<!-- IF S_POLL_DELETE_CHECKED --> checked="checked"<!-- ENDIF --> /> </label></dd>
- </dl>
- <!-- ENDIF -->
<dl>
<dt><label for="poll_title">{L_POLL_QUESTION}{L_COLON}</label></dt>
<dd><input type="text" name="poll_title" id="poll_title" maxlength="255" value="{POLL_TITLE}" class="inputbox" /></dd>
@@ -43,13 +44,9 @@
<dd><label for="poll_vote_change"><input type="checkbox" id="poll_vote_change" name="poll_vote_change"{VOTE_CHANGE_CHECKED} /> {L_POLL_VOTE_CHANGE_EXPLAIN}</label></dd>
</dl>
<!-- ENDIF -->
-
- <!-- ELSEIF S_POLL_DELETE -->
- <dl class="fields1">
- <dt><label for="poll_delete">{L_POLL_DELETE}{L_COLON}</label></dt>
- <dd><label for="poll_delete"><input type="checkbox" name="poll_delete" id="poll_delete"<!-- IF S_POLL_DELETE_CHECKED --> checked="checked"<!-- ENDIF --> /> </label></dd>
- </dl>
<!-- ENDIF -->
+
+ <!-- EVENT posting_poll_body_options_after -->
</fieldset>
</div>
diff --git a/phpBB/styles/prosilver/template/search_body.html b/phpBB/styles/prosilver/template/search_body.html
index 2f15830eb1..8d56a103d2 100644
--- a/phpBB/styles/prosilver/template/search_body.html
+++ b/phpBB/styles/prosilver/template/search_body.html
@@ -2,6 +2,7 @@
<h2 class="solo">{L_SEARCH}</h2>
+<!-- EVENT search_body_form_before -->
<form method="get" action="{S_SEARCH_ACTION}" data-focus="keywords">
<div class="panel">
diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html
index 2767eb85a3..f76afe3767 100644
--- a/phpBB/styles/prosilver/template/search_results.html
+++ b/phpBB/styles/prosilver/template/search_results.html
@@ -19,7 +19,7 @@
<div class="action-bar top">
<!-- IF TOTAL_MATCHES > 0 -->
- <div class="search-box">
+ <div class="search-box" role="search">
<form method="post" action="{S_SEARCH_ACTION}">
<fieldset>
<input class="inputbox search tiny" type="search" name="add_keywords" id="add_keywords" value="" placeholder="{L_SEARCH_IN_RESULTS}" />
diff --git a/phpBB/styles/prosilver/template/simple_footer.html b/phpBB/styles/prosilver/template/simple_footer.html
index d5d0f45fa9..123f8992f2 100644
--- a/phpBB/styles/prosilver/template/simple_footer.html
+++ b/phpBB/styles/prosilver/template/simple_footer.html
@@ -1,6 +1,6 @@
</div>
- <div class="copyright">{CREDIT_LINE}
+ <div class="copyright" role="contentinfo">{CREDIT_LINE}
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
<!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF -->
</div>
diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html
index a0c7bc68bb..ab4f855a97 100644
--- a/phpBB/styles/prosilver/template/simple_header.html
+++ b/phpBB/styles/prosilver/template/simple_header.html
@@ -2,7 +2,7 @@
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
<head>
<meta charset="utf-8" />
-<meta name="viewport" content="width=device-width" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
{META}
<title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>
@@ -36,4 +36,4 @@
<div id="wrap">
<a id="top" class="anchor" accesskey="t"></a>
- <div id="page-body">
+ <div id="page-body" role="main">
diff --git a/phpBB/styles/prosilver/template/ucp_login_link.html b/phpBB/styles/prosilver/template/ucp_login_link.html
index d3c6931ce3..be173318cb 100644
--- a/phpBB/styles/prosilver/template/ucp_login_link.html
+++ b/phpBB/styles/prosilver/template/ucp_login_link.html
@@ -36,7 +36,7 @@
</dl>
<dl>
<dt><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}{L_COLON}</label></dt>
- <dd><input type="password" tabindex="3" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" /></dd>
+ <dd><input type="password" tabindex="3" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" autocomplete="off" /></dd>
</dl>
<!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
<!-- DEFINE $CAPTCHA_TAB_INDEX = 4 -->
diff --git a/phpBB/styles/prosilver/template/ucp_profile_reg_details.html b/phpBB/styles/prosilver/template/ucp_profile_reg_details.html
index 2642b7a419..462a7f8f20 100644
--- a/phpBB/styles/prosilver/template/ucp_profile_reg_details.html
+++ b/phpBB/styles/prosilver/template/ucp_profile_reg_details.html
@@ -19,16 +19,16 @@
</dl>
<dl>
<dt><label for="email">{L_EMAIL_ADDRESS}{L_COLON}</label></dt>
- <dd><!-- IF S_CHANGE_EMAIL --><input type="email" name="email" id="email" maxlength="100" value="{EMAIL}" class="inputbox" title="{L_EMAIL_ADDRESS}" /><!-- ELSE --><strong>{EMAIL}</strong><!-- ENDIF --></dd>
+ <dd><!-- IF S_CHANGE_EMAIL --><input type="email" name="email" id="email" maxlength="100" value="{EMAIL}" class="inputbox" title="{L_EMAIL_ADDRESS}" autocomplete="off" /><!-- ELSE --><strong>{EMAIL}</strong><!-- ENDIF --></dd>
</dl>
<!-- IF S_CHANGE_PASSWORD -->
<dl>
<dt><label for="new_password">{L_NEW_PASSWORD}{L_COLON}</label><br /><span>{L_CHANGE_PASSWORD_EXPLAIN}</span></dt>
- <dd><input type="password" name="new_password" id="new_password" maxlength="255" value="{NEW_PASSWORD}" class="inputbox" title="{L_CHANGE_PASSWORD}" /></dd>
+ <dd><input type="password" name="new_password" id="new_password" maxlength="255" value="{NEW_PASSWORD}" class="inputbox" title="{L_CHANGE_PASSWORD}" autocomplete="off" /></dd>
</dl>
<dl>
<dt><label for="password_confirm">{L_CONFIRM_PASSWORD}{L_COLON}</label><br /><span>{L_CONFIRM_PASSWORD_EXPLAIN}</span></dt>
- <dd><input type="password" name="password_confirm" id="password_confirm" maxlength="255" value="{PASSWORD_CONFIRM}" class="inputbox" title="{L_CONFIRM_PASSWORD}" /></dd>
+ <dd><input type="password" name="password_confirm" id="password_confirm" maxlength="255" value="{PASSWORD_CONFIRM}" class="inputbox" title="{L_CONFIRM_PASSWORD}" autocomplete="off" /></dd>
</dl>
<!-- ENDIF -->
<!-- EVENT ucp_profile_register_details_after -->
@@ -42,7 +42,7 @@
<fieldset>
<dl>
<dt><label for="cur_password">{L_CURRENT_PASSWORD}{L_COLON}</label><br /><span><!-- IF S_CHANGE_PASSWORD -->{L_CURRENT_CHANGE_PASSWORD_EXPLAIN}<!-- ELSE -->{L_CURRENT_PASSWORD_EXPLAIN}<!-- ENDIF --></span></dt>
- <dd><input type="password" name="cur_password" id="cur_password" maxlength="255" value="{CUR_PASSWORD}" class="inputbox" title="{L_CURRENT_PASSWORD}" /></dd>
+ <dd><input type="password" name="cur_password" id="cur_password" maxlength="255" value="{CUR_PASSWORD}" class="inputbox" title="{L_CURRENT_PASSWORD}" autocomplete="off" /></dd>
</dl>
</fieldset>
diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html
index 020f69cb26..fafd0cce00 100644
--- a/phpBB/styles/prosilver/template/ucp_register.html
+++ b/phpBB/styles/prosilver/template/ucp_register.html
@@ -33,15 +33,15 @@
</dl>
<dl>
<dt><label for="email">{L_EMAIL_ADDRESS}{L_COLON}</label></dt>
- <dd><input type="email" tabindex="2" name="email" id="email" size="25" maxlength="100" value="{EMAIL}" class="inputbox autowidth" title="{L_EMAIL_ADDRESS}" /></dd>
+ <dd><input type="email" tabindex="2" name="email" id="email" size="25" maxlength="100" value="{EMAIL}" class="inputbox autowidth" title="{L_EMAIL_ADDRESS}" autocomplete="off" /></dd>
</dl>
<dl>
<dt><label for="new_password">{L_PASSWORD}{L_COLON}</label><br /><span>{L_PASSWORD_EXPLAIN}</span></dt>
- <dd><input type="password" tabindex="4" name="new_password" id="new_password" size="25" value="{PASSWORD}" class="inputbox autowidth" title="{L_NEW_PASSWORD}" /></dd>
+ <dd><input type="password" tabindex="4" name="new_password" id="new_password" size="25" value="{PASSWORD}" class="inputbox autowidth" title="{L_NEW_PASSWORD}" autocomplete="off" /></dd>
</dl>
<dl>
<dt><label for="password_confirm">{L_CONFIRM_PASSWORD}{L_COLON}</label></dt>
- <dd><input type="password" tabindex="5" name="password_confirm" id="password_confirm" size="25" value="{PASSWORD_CONFIRM}" class="inputbox autowidth" title="{L_CONFIRM_PASSWORD}" /></dd>
+ <dd><input type="password" tabindex="5" name="password_confirm" id="password_confirm" size="25" value="{PASSWORD_CONFIRM}" class="inputbox autowidth" title="{L_CONFIRM_PASSWORD}" autocomplete="off" /></dd>
</dl>
<!-- EVENT ucp_register_credentials_after -->
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index 43e994f1f9..2679a2cd29 100644
--- a/phpBB/styles/prosilver/template/viewforum_body.html
+++ b/phpBB/styles/prosilver/template/viewforum_body.html
@@ -1,7 +1,7 @@
<!-- INCLUDE overall_header.html -->
-
+<!-- EVENT viewforum_forum_title_before -->
<h2 class="forum-title"><!-- EVENT viewforum_forum_name_prepend --><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- EVENT viewforum_forum_name_append --></h2>
-
+<!-- EVENT viewforum_forum_title_after -->
<!-- IF FORUM_DESC or MODERATORS or U_MCP -->
<div>
<!-- NOTE: remove the style="display: none" when you want to have the forum description on the forum body -->
@@ -50,7 +50,7 @@
<!-- ENDIF -->
<!-- IF S_DISPLAY_SEARCHBOX -->
- <div class="search-box">
+ <div class="search-box" role="search">
<form method="get" id="forum-search" action="{S_SEARCHBOX_ACTION}">
<fieldset>
<input class="inputbox search tiny" type="search" name="keywords" id="search_keywords" size="20" placeholder="{L_SEARCH_FORUM}" />
@@ -100,7 +100,7 @@
</dl>
<dl>
<dt><label for="password">{L_PASSWORD}{L_COLON}</label></dt>
- <dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" /></dd>
+ <dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" autocomplete="off" /></dd>
<!-- IF S_AUTOLOGIN_ENABLED --><dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="3" /> {L_LOG_ME_IN}</label></dd><!-- ENDIF -->
<dd><label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="4" /> {L_HIDE_ME}</label></dd>
</dl>
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index d39645cbe2..e976c36f7b 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -42,7 +42,7 @@
<!-- INCLUDE viewtopic_topic_tools.html -->
<!-- IF S_DISPLAY_SEARCHBOX -->
- <div class="search-box">
+ <div class="search-box" role="search">
<form method="get" id="topic-search" action="{S_SEARCHBOX_ACTION}">
<fieldset>
<input class="inputbox search tiny" type="search" name="keywords" id="search_keywords" size="20" placeholder="{L_SEARCH_TOPIC}" />
@@ -210,6 +210,7 @@
<h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3>
+ <!-- EVENT viewtopic_body_post_buttons_list_before -->
<!-- IF not S_IS_BOT -->
<!-- IF postrow.U_EDIT or postrow.U_DELETE or postrow.U_REPORT or postrow.U_WARN or postrow.U_INFO or postrow.U_QUOTE -->
<ul class="post-buttons">
@@ -248,6 +249,7 @@
</ul>
<!-- ENDIF -->
<!-- ENDIF -->
+ <!-- EVENT viewtopic_body_post_buttons_list_after -->
<!-- EVENT viewtopic_body_postrow_post_details_before -->
<p class="author"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF --><span class="responsive-hide">{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> &raquo; </span>{postrow.POST_DATE} </p>
diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css
index 889110e3fc..f3468ebcf2 100644
--- a/phpBB/styles/prosilver/theme/bidi.css
+++ b/phpBB/styles/prosilver/theme/bidi.css
@@ -182,8 +182,7 @@
/* Misc layout styles
---------------------------------------- */
-/* column[1-2] styles are containers for two column layouts
- Also see tweaks.css */
+/* column[1-2] styles are containers for two column layouts */
.rtl .column1 {
float: right;
clear: right;
@@ -313,6 +312,13 @@ li.breadcrumbs span:first-child > a {
padding-right: 19px;
}
+/* Notification mark read link */
+.rtl .dropdown-extended a.mark_read {
+ border-radius: 0 3px 3px 0;
+ left: 0;
+ right: auto;
+}
+
.rtl a.top {
float: left;
}
@@ -596,9 +602,6 @@ li.breadcrumbs span:first-child > a {
/**
* buttons.css
*/
-/* Rollover buttons
- Based on: http://wellstyled.com/css-nopreload-rollovers.html
-----------------------------------------*/
.rtl .dropdown-select {
padding-left: 24px;
padding-right: 8px;
@@ -976,10 +979,6 @@ li.breadcrumbs span:first-child > a {
padding-left: 0;
}
-/**
-* tweaks.css
-*/
-
/* Form button styles
---------------------------------------- */
diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css
index aecac4defd..f9a520369e 100644
--- a/phpBB/styles/prosilver/theme/buttons.css
+++ b/phpBB/styles/prosilver/theme/buttons.css
@@ -1,9 +1,6 @@
/* Button Styles
---------------------------------------- */
-/* Rollover buttons
- Based on: http://wellstyled.com/css-nopreload-rollovers.html
-----------------------------------------*/
.button {
cursor: pointer;
display: inline-block;
diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css
index 4743b4b39b..29cf641df2 100644
--- a/phpBB/styles/prosilver/theme/colours.css
+++ b/phpBB/styles/prosilver/theme/colours.css
@@ -977,6 +977,14 @@ fieldset.quick-login input.inputbox {
color: #333333;
}
+#message-box textarea.drag-n-drop {
+ outline-color: rgba(102, 102, 102, 0.5);
+}
+
+#message-box textarea.drag-n-drop-highlight {
+ outline-color: rgba(17, 163, 234, 0.5);
+}
+
/* Input field styles
---------------------------------------- */
.inputbox {
diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css
index 11e3314f17..7b17c58698 100644
--- a/phpBB/styles/prosilver/theme/common.css
+++ b/phpBB/styles/prosilver/theme/common.css
@@ -53,14 +53,13 @@ html {
}
body {
- /* Text-Sizing with ems: http://www.clagnut.com/blog/348/ */
font-family: Verdana, Helvetica, Arial, sans-serif;
- /*font-size: 62.5%; This sets the default font size to be equivalent to 10px */
font-size: 10px;
line-height: normal;
margin: 0;
padding: 12px 0;
word-wrap: break-word;
+ -webkit-print-color-adjust: exact;
}
h1 {
@@ -113,7 +112,6 @@ img {
}
hr {
- /* Also see tweaks.css */
border: 0 solid transparent;
border-top-width: 1px;
height: 1px;
@@ -713,8 +711,7 @@ table.info tbody th {
/* Misc layout styles
---------------------------------------- */
-/* column[1-2] styles are containers for two column layouts
- Also see tweaks.css */
+/* column[1-2] styles are containers for two column layouts */
.column1 {
float: left;
clear: left;
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css
index e73f8c9d54..380b285b83 100644
--- a/phpBB/styles/prosilver/theme/content.css
+++ b/phpBB/styles/prosilver/theme/content.css
@@ -259,7 +259,6 @@ dd.option {
}
.postbody h3 img {
- /* Also see tweaks.css */
vertical-align: bottom;
}
@@ -510,7 +509,6 @@ blockquote .codebox {
}
.codebox code {
- /* Also see tweaks.css */
overflow: auto;
display: block;
height: auto;
@@ -693,7 +691,6 @@ fieldset.polls dd div {
/* Poster profile block
----------------------------------------*/
.postprofile {
- /* Also see tweaks.css */
margin: 5px 0 10px 0;
min-height: 80px;
border: 1px solid transparent;
diff --git a/phpBB/styles/prosilver/theme/forms.css b/phpBB/styles/prosilver/theme/forms.css
index f08a8a9691..777f011c35 100644
--- a/phpBB/styles/prosilver/theme/forms.css
+++ b/phpBB/styles/prosilver/theme/forms.css
@@ -243,6 +243,13 @@ fieldset.submit-buttons input {
max-width: 100%;
font-size: 1.2em;
resize: vertical;
+ outline: 3px dashed transparent;
+ outline-offset: -4px;
+ -webkit-transition: all .5s ease;
+ -moz-transition: all .5s ease;
+ -ms-transition: all .5s ease;
+ -o-transition: all .5s ease;
+ transition: all .5s ease;
}
/* Emoticons panel */
diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg
index 8f3f55ec87..5fe8de0840 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.3
-phpbb_version = 3.1.3
+style_version = 3.1.4
+phpbb_version = 3.1.4
# Defining a different template bitfield
# template_bitfield = lNg=
diff --git a/phpBB/styles/subsilver2/template/index_body.html b/phpBB/styles/subsilver2/template/index_body.html
index bfc2229221..c0a8d5fd57 100644
--- a/phpBB/styles/subsilver2/template/index_body.html
+++ b/phpBB/styles/subsilver2/template/index_body.html
@@ -116,7 +116,7 @@
<td class="cat"><h4><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></h4></td>
</tr>
<tr>
- <td class="row1" align="center"><span class="genmed">{L_USERNAME}{L_COLON}</span> <input class="post" type="text" name="username" size="10" />&nbsp; <span class="genmed">{L_PASSWORD}{L_COLON}</span> <input class="post" type="password" name="password" size="10" />&nbsp; <!-- IF U_SEND_PASSWORD --><a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a>&nbsp; <!-- ENDIF --> <!-- IF S_AUTOLOGIN_ENABLED --> <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF -->&nbsp; <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td>
+ <td class="row1" align="center"><span class="genmed">{L_USERNAME}{L_COLON}</span> <input class="post" type="text" name="username" size="10" />&nbsp; <span class="genmed">{L_PASSWORD}{L_COLON}</span> <input class="post" type="password" name="password" size="10" autocomplete="off" />&nbsp; <!-- IF U_SEND_PASSWORD --><a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a>&nbsp; <!-- ENDIF --> <!-- IF S_AUTOLOGIN_ENABLED --> <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF -->&nbsp; <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td>
</tr>
</table>
{S_LOGIN_REDIRECT}
diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html
index ed63e748cf..1067f3738d 100644
--- a/phpBB/styles/subsilver2/template/login_body.html
+++ b/phpBB/styles/subsilver2/template/login_body.html
@@ -44,7 +44,7 @@
<tr>
<td valign="top" <!-- IF S_ADMIN_AUTH -->style="width: 50%; text-align: {S_CONTENT_FLOW_END};"<!-- ENDIF -->><b class="gensmall">{L_PASSWORD}{L_COLON}</b></td>
<td>
- <input class="post" type="password" name="{PASSWORD_CREDENTIAL}" size="25" tabindex="2" />
+ <input class="post" type="password" name="{PASSWORD_CREDENTIAL}" size="25" tabindex="2" autocomplete="off" />
<!-- IF U_SEND_PASSWORD --><br /><a class="gensmall" href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a><!-- ENDIF -->
<!-- IF U_RESEND_ACTIVATION and not S_ADMIN_AUTH --><br /><a class="gensmall" href="{U_RESEND_ACTIVATION}">{L_RESEND_ACTIVATION}</a><!-- ENDIF -->
</td>
diff --git a/phpBB/styles/subsilver2/template/login_forum.html b/phpBB/styles/subsilver2/template/login_forum.html
index 9a141fc295..2cda9f3452 100644
--- a/phpBB/styles/subsilver2/template/login_forum.html
+++ b/phpBB/styles/subsilver2/template/login_forum.html
@@ -30,7 +30,7 @@
<!-- ENDIF -->
<tr>
<td class="gensmall"><b>{L_PASSWORD}{L_COLON}</b></td>
- <td><input class="post" type="password" name="password" size="25" tabindex="2" /></td>
+ <td><input class="post" type="password" name="password" size="25" tabindex="2" autocomplete="off" /></td>
</tr>
</table>
</td>
diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html
index f5052ee2d0..1a29df94b0 100644
--- a/phpBB/styles/subsilver2/template/mcp_post.html
+++ b/phpBB/styles/subsilver2/template/mcp_post.html
@@ -143,7 +143,7 @@
<!-- IF S_TOPIC_REVIEW --><!-- INCLUDE posting_topic_review.html --><!-- ENDIF -->
<!-- ELSE -->
- <!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER -->
+ <!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER or S_MCP_POST_ADDITIONAL_OPTS -->
<br /><a name="mod" class="anchor"></a>
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg">
@@ -156,6 +156,9 @@
<td class="row2"><form method="post" name="mcp_chgposter" action="{U_POST_ACTION}"><input class="post" type="text" name="username" value="" /> <input class="btnmain" type="submit" value="{L_CONFIRM}" name="action[chgposter]" /><br /><span class="gensmall">[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</span><!-- IF S_USER_SELECT --><br /><select name="u">{S_USER_SELECT}</select> <input type="submit" class="btnmain" name="action[chgposter_ip]" value="{L_CONFIRM}" /><!-- ENDIF -->{S_FORM_TOKEN}</form></td>
</tr>
<!-- ENDIF -->
+
+ <!-- EVENT mcp_post_additional_options -->
+
<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST -->
<tr>
<td class="row1" valign="top"><b class="gen">{L_MOD_OPTIONS}</b></td>
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index 225a7d85ff..f3693eb865 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -152,7 +152,7 @@ function marklist(id, name, state)
</tr>
</table>
</div>
-
+ <!-- EVENT overall_header_navbar_before -->
<div id="menubar">
<table width="100%" cellspacing="0">
<tr>
diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html
index 321e4227ee..cde6873a90 100644
--- a/phpBB/styles/subsilver2/template/posting_body.html
+++ b/phpBB/styles/subsilver2/template/posting_body.html
@@ -171,6 +171,7 @@
<!-- EVENT posting_editor_subject_after -->
<tr>
<td class="row1" valign="top"><b class="genmed">{L_MESSAGE_BODY}{L_COLON}</b><br /><span class="gensmall">{L_MESSAGE_BODY_EXPLAIN}&nbsp;</span><br /><br />
+ <!-- EVENT posting_editor_smilies_before -->
<!-- IF S_SMILIES_ALLOWED -->
<table width="100%" cellspacing="5" cellpadding="0" border="0" align="center">
<tr>
@@ -192,6 +193,7 @@
</table>
<!-- ENDIF -->
+ <!-- EVENT posting_editor_smilies_after -->
</td>
<td class="row2" valign="top">
<script type="text/javascript">
@@ -219,7 +221,7 @@
<!-- IF S_INLINE_ATTACHMENT_OPTIONS -->
<tr>
<td class="row1"><b class="genmed">{L_ATTACHMENTS}{L_COLON}</b></td>
- <td class="row2"><select name="attachments">{S_INLINE_ATTACHMENT_OPTIONS}</select>&nbsp;<input type="button" class="btnbbcode" accesskey="a" value="{L_PLACE_INLINE}" name="attachinline" onclick="attach_form = document.forms[form_name].elements['attachments']; attach_inline(attach_form.value, attach_form.options[attach_form.selectedIndex].text);" onmouseover="helpline('a')" onmouseout="helpline('tip')" />
+ <td class="row2"><select name="attachments">{S_INLINE_ATTACHMENT_OPTIONS}</select>&nbsp;<input type="button" class="btnbbcode" accesskey="a" value="{L_PLACE_INLINE}" name="attachinline" onclick="attach_form = document.forms[form_name].elements['attachments']; attachInline(attach_form.value, attach_form.options[attach_form.selectedIndex].text);" onmouseover="helpline('a')" onmouseout="helpline('tip')" />
</td>
</tr>
<!-- ENDIF -->
@@ -246,6 +248,7 @@
</tr>
</table>
</td>
+ <!-- EVENT posting_editor_bbcode_status_after -->
<td class="row2">
<table cellpadding="1">
<!-- EVENT posting_editor_options_prepend -->
diff --git a/phpBB/styles/subsilver2/template/posting_poll_body.html b/phpBB/styles/subsilver2/template/posting_poll_body.html
index 8d98b36c86..07cb6d527e 100644
--- a/phpBB/styles/subsilver2/template/posting_poll_body.html
+++ b/phpBB/styles/subsilver2/template/posting_poll_body.html
@@ -27,6 +27,7 @@
<td class="row2"><input type="checkbox" class="radio" name="poll_vote_change"{VOTE_CHANGE_CHECKED} /></td>
</tr>
<!-- ENDIF -->
+<!-- EVENT posting_poll_body_options_after -->
<!-- IF S_POLL_DELETE -->
<tr>
diff --git a/phpBB/styles/subsilver2/template/search_body.html b/phpBB/styles/subsilver2/template/search_body.html
index c0199fbae8..d3aa758b43 100644
--- a/phpBB/styles/subsilver2/template/search_body.html
+++ b/phpBB/styles/subsilver2/template/search_body.html
@@ -2,6 +2,7 @@
<div id="pagecontent">
+ <!-- EVENT search_body_form_before -->
<form method="get" action="{S_SEARCH_ACTION}">
<table class="tablebg" width="100%" cellspacing="1">
diff --git a/phpBB/styles/subsilver2/template/ucp_login_link.html b/phpBB/styles/subsilver2/template/ucp_login_link.html
index 5d8e3ee27b..6db9890d8c 100644
--- a/phpBB/styles/subsilver2/template/ucp_login_link.html
+++ b/phpBB/styles/subsilver2/template/ucp_login_link.html
@@ -52,7 +52,7 @@
<tr>
<td><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}{L_COLON}</label></td>
- <td><input type="password" tabindex="3" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" /></td>
+ <td><input type="password" tabindex="3" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" autocomplete="off" /></td>
</tr>
<!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
diff --git a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html b/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html
index 090d729326..862956a1d0 100644
--- a/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html
+++ b/phpBB/styles/subsilver2/template/ucp_profile_reg_details.html
@@ -21,16 +21,16 @@
</tr>
<tr>
<td class="row1" width="35%"><b class="genmed">{L_EMAIL_ADDRESS}{L_COLON} </b></td>
- <td class="row2"><!-- IF S_CHANGE_EMAIL --><input type="email" class="post" name="email" size="30" maxlength="100" value="{EMAIL}" /><!-- ELSE --><b class="gen">{EMAIL}</b><!-- ENDIF --></td>
+ <td class="row2"><!-- IF S_CHANGE_EMAIL --><input type="email" class="post" name="email" size="30" maxlength="100" value="{EMAIL}" autocomplete="off" /><!-- ELSE --><b class="gen">{EMAIL}</b><!-- ENDIF --></td>
</tr>
<!-- IF S_CHANGE_PASSWORD -->
<tr>
<td class="row1" width="35%"><b class="genmed">{L_NEW_PASSWORD}{L_COLON} </b><br /><span class="gensmall">{L_CHANGE_PASSWORD_EXPLAIN}</span></td>
- <td class="row2"><input type="password" class="post" name="new_password" size="30" maxlength="255" value="{NEW_PASSWORD}" /></td>
+ <td class="row2"><input type="password" class="post" name="new_password" size="30" maxlength="255" value="{NEW_PASSWORD}" autocomplete="off" /></td>
</tr>
<tr>
<td class="row1" width="35%"><b class="genmed">{L_CONFIRM_PASSWORD}{L_COLON} </b><br /><span class="gensmall">{L_CONFIRM_PASSWORD_EXPLAIN}</span></td>
- <td class="row2"><input type="password" class="post" name="password_confirm" size="30" maxlength="255" value="{PASSWORD_CONFIRM}" /></td>
+ <td class="row2"><input type="password" class="post" name="password_confirm" size="30" maxlength="255" value="{PASSWORD_CONFIRM}" autocomplete="off" /></td>
</tr>
<!-- ENDIF -->
<!-- EVENT ucp_profile_register_details_after -->
@@ -39,7 +39,7 @@
</tr>
<tr>
<td class="row1" width="35%"><b class="genmed">{L_CURRENT_PASSWORD}{L_COLON} </b><br /><span class="gensmall"><!-- IF S_CHANGE_PASSWORD -->{L_CURRENT_CHANGE_PASSWORD_EXPLAIN}<!-- ELSE -->{L_CURRENT_PASSWORD_EXPLAIN}<!-- ENDIF --></span></td>
- <td class="row2"><input type="password" class="post" name="cur_password" size="30" maxlength="255" value="{CUR_PASSWORD}" /></td>
+ <td class="row2"><input type="password" class="post" name="cur_password" size="30" maxlength="255" value="{CUR_PASSWORD}" autocomplete="off" /></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html
index 162fa2a020..9b9e164df4 100644
--- a/phpBB/styles/subsilver2/template/ucp_register.html
+++ b/phpBB/styles/subsilver2/template/ucp_register.html
@@ -41,15 +41,15 @@
</tr>
<tr>
<td class="row1"><b class="genmed">{L_EMAIL_ADDRESS}{L_COLON} </b></td>
- <td class="row2"><input class="post" type="email" name="email" size="25" maxlength="100" value="{EMAIL}" /></td>
+ <td class="row2"><input class="post" type="email" name="email" size="25" maxlength="100" value="{EMAIL}" autocomplete="off" /></td>
</tr>
<tr>
<td class="row1"><b class="genmed">{L_PASSWORD}{L_COLON} </b><br /><span class="gensmall">{L_PASSWORD_EXPLAIN}</span></td>
- <td class="row2"><input class="post" type="password" name="new_password" size="25" value="{PASSWORD}" /></td>
+ <td class="row2"><input class="post" type="password" name="new_password" size="25" value="{PASSWORD}" autocomplete="off" /></td>
</tr>
<tr>
<td class="row1"><b class="genmed">{L_CONFIRM_PASSWORD}{L_COLON} </b></td>
- <td class="row2"><input class="post" type="password" name="password_confirm" size="25" value="{PASSWORD_CONFIRM}" /></td>
+ <td class="row2"><input class="post" type="password" name="password_confirm" size="25" value="{PASSWORD_CONFIRM}" autocomplete="off" /></td>
</tr>
<!-- EVENT ucp_register_credentials_after -->
<!-- EVENT ucp_register_options_before -->
diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html
index 925581ffcd..83b01b9f6d 100644
--- a/phpBB/styles/subsilver2/template/viewforum_body.html
+++ b/phpBB/styles/subsilver2/template/viewforum_body.html
@@ -103,8 +103,9 @@
<!-- IF S_IS_POSTABLE or S_NO_READ_ACCESS -->
<div id="pageheader">
+ <!-- EVENT viewforum_forum_title_before -->
<h2><!-- EVENT viewforum_forum_name_prepend --><a class="titles" href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- EVENT viewforum_forum_name_append --></h2>
-
+ <!-- EVENT viewforum_forum_title_after -->
<!-- IF MODERATORS -->
<p class="moderators"><!-- IF S_SINGLE_MODERATOR -->{L_MODERATOR}<!-- ELSE -->{L_MODERATORS}<!-- ENDIF -->{L_COLON} {MODERATORS}</p>
<!-- ENDIF -->
@@ -136,7 +137,7 @@
<td class="cat"><h4><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></h4></td>
</tr>
<tr>
- <td class="row1" align="center"><span class="genmed">{L_USERNAME}{L_COLON}</span> <input class="post" type="text" name="username" size="10" />&nbsp; <span class="genmed">{L_PASSWORD}{L_COLON}</span> <input class="post" type="password" name="password" size="10" /><!-- IF S_AUTOLOGIN_ENABLED -->&nbsp; <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF -->&nbsp; <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td>
+ <td class="row1" align="center"><span class="genmed">{L_USERNAME}{L_COLON}</span> <input class="post" type="text" name="username" size="10" />&nbsp; <span class="genmed">{L_PASSWORD}{L_COLON}</span> <input class="post" type="password" name="password" size="10" autocomplete="off" /><!-- IF S_AUTOLOGIN_ENABLED -->&nbsp; <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF -->&nbsp; <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td>
</tr>
</table>
{S_LOGIN_REDIRECT}
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php
index 9589fb54e2..583e297682 100644
--- a/phpBB/viewonline.php
+++ b/phpBB/viewonline.php
@@ -86,10 +86,26 @@ if ($mode == 'whois' && $auth->acl_get('a_') && $session_id)
}
// Forum info
-$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
- FROM ' . FORUMS_TABLE . '
- ORDER BY left_id ASC';
-$result = $db->sql_query($sql, 600);
+$sql_ary = array(
+ 'SELECT' => 'f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id',
+ 'FROM' => array(
+ FORUMS_TABLE => 'f',
+ ),
+ 'ORDER_BY' => 'f.left_id ASC',
+);
+
+/**
+* Modify the forum data SQL query for getting additional fields if needed
+*
+* @event core.viewonline_modify_forum_data_sql
+* @var array sql_ary The SQL array
+* @since 3.1.5-RC1
+*/
+$vars = array('sql_ary');
+extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_forum_data_sql', compact($vars)));
+
+$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary), 600);
+unset($sql_ary);
$forum_data = array();
while ($row = $db->sql_fetchrow($result))
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 131230897f..bb1f2c925d 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -804,6 +804,36 @@ if (!empty($topic_data['poll_start']))
($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false;
$s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || $view == 'viewpoll') ? true : false;
+ /**
+ * Event to manipulate the poll data
+ *
+ * @event core.viewtopic_modify_poll_data
+ * @var array cur_voted_id Array with options' IDs current user has voted for
+ * @var int forum_id The topic's forum id
+ * @var array poll_info Array with the poll information
+ * @var bool s_can_vote Flag indicating if a user can vote
+ * @var bool s_display_results Flag indicating if results or poll options should be displayed
+ * @var int topic_id The id of the topic the user tries to access
+ * @var array topic_data All the information from the topic and forum tables for this topic
+ * @var string viewtopic_url URL to the topic page
+ * @var array vote_counts Array with the vote counts for every poll option
+ * @var array voted_id Array with updated options' IDs current user is voting for
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'cur_voted_id',
+ 'forum_id',
+ 'poll_info',
+ 's_can_vote',
+ 's_display_results',
+ 'topic_id',
+ 'topic_data',
+ 'viewtopic_url',
+ 'vote_counts',
+ 'voted_id',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_data', compact($vars)));
+
if ($update && $s_can_vote)
{
@@ -937,6 +967,7 @@ if (!empty($topic_data['poll_start']))
$topic_data['poll_title'] = generate_text_for_display($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield'], $parse_flags, true);
+ $poll_template_data = $poll_options_template_data = array();
foreach ($poll_info as $poll_option)
{
$option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0;
@@ -945,7 +976,7 @@ if (!empty($topic_data['poll_start']))
$option_pct_rel_txt = sprintf("%.1d%%", round($option_pct_rel * 100));
$option_most_votes = ($poll_option['poll_option_total'] > 0 && $poll_option['poll_option_total'] == $poll_most) ? true : false;
- $template->assign_block_vars('poll_option', array(
+ $poll_options_template_data[] = array(
'POLL_OPTION_ID' => $poll_option['poll_option_id'],
'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'],
'POLL_OPTION_RESULT' => $poll_option['poll_option_total'],
@@ -955,12 +986,12 @@ if (!empty($topic_data['poll_start']))
'POLL_OPTION_WIDTH' => round($option_pct * 250),
'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false,
'POLL_OPTION_MOST_VOTES' => $option_most_votes,
- ));
+ );
}
$poll_end = $topic_data['poll_length'] + $topic_data['poll_start'];
- $template->assign_vars(array(
+ $poll_template_data = array(
'POLL_QUESTION' => $topic_data['poll_title'],
'TOTAL_VOTES' => $poll_total,
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
@@ -976,9 +1007,45 @@ if (!empty($topic_data['poll_start']))
'S_POLL_ACTION' => $viewtopic_url,
'U_VIEW_RESULTS' => $viewtopic_url . '&amp;view=viewpoll',
- ));
+ );
+
+ /**
+ * Event to add/modify poll template data
+ *
+ * @event core.viewtopic_modify_poll_template_data
+ * @var array cur_voted_id Array with options' IDs current user has voted for
+ * @var int poll_end The poll end time
+ * @var array poll_info Array with the poll information
+ * @var array poll_options_template_data Array with the poll options template data
+ * @var array poll_template_data Array with the common poll template data
+ * @var int poll_total Total poll votes count
+ * @var int poll_most Mostly voted option votes count
+ * @var array topic_data All the information from the topic and forum tables for this topic
+ * @var string viewtopic_url URL to the topic page
+ * @var array vote_counts Array with the vote counts for every poll option
+ * @var array voted_id Array with updated options' IDs current user is voting for
+ * @since 3.1.5-RC1
+ */
+ $vars = array(
+ 'cur_voted_id',
+ 'poll_end',
+ 'poll_info',
+ 'poll_options_template_data',
+ 'poll_template_data',
+ 'poll_total',
+ 'poll_most',
+ 'topic_data',
+ 'viewtopic_url',
+ 'vote_counts',
+ 'voted_id',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_template_data', compact($vars)));
+
+ $template->assign_block_vars_array('poll_option', $poll_options_template_data);
+
+ $template->assign_vars($poll_template_data);
- unset($poll_end, $poll_info, $voted_id);
+ unset($poll_end, $poll_info, $poll_options_template_data, $poll_template_data, $voted_id);
}
// If the user is trying to reach the second half of the topic, fetch it starting from the end
diff --git a/phpBB/web.config b/phpBB/web.config
index a73c328626..99a1fe6023 100644
--- a/phpBB/web.config
+++ b/phpBB/web.config
@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
+ <rewrite>
+ <rules>
+ <rule name="Extension Routes" stopProcessing="true">
+ <match url="^(.*)$" ignoreCase="true" />
+ <conditions>
+ <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
+ <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
+ </conditions>
+ <action type="Rewrite" url="app.php" appendQueryString="true" />
+ </rule>
+ </rules>
+ </rewrite>
<security>
<requestFiltering>
<hiddenSegments>
diff --git a/tests/captcha/qa_test.php b/tests/captcha/qa_test.php
new file mode 100644
index 0000000000..1f2f9f3070
--- /dev/null
+++ b/tests/captcha/qa_test.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+
+class phpbb_captcha_qa_test extends \phpbb_database_test_case
+{
+ protected $request;
+
+ /** @var \phpbb\captcha\plugins\qa */
+ protected $qa;
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml');
+ }
+
+ public function setUp()
+ {
+ global $db;
+
+ $db = $this->new_dbal();
+
+ parent::setUp();
+
+ $this->request = new \phpbb_mock_request();
+ request_var(false, false, false, false, $this->request);
+ $this->qa = new \phpbb\captcha\plugins\qa('phpbb_captcha_questions', 'phpbb_captcha_answers', 'phpbb_qa_confirm');
+ }
+
+ public function test_is_installed()
+ {
+ $this->assertFalse($this->qa->is_installed());
+
+ $this->qa->install();
+
+ $this->assertTrue($this->qa->is_installed());
+ }
+
+ public function test_set_get_name()
+ {
+ $this->assertNull($this->qa->get_service_name());
+ $this->qa->set_name('foobar');
+ $this->assertSame('foobar', $this->qa->get_service_name());
+ }
+
+ public function data_acp_get_question_input()
+ {
+ return array(
+ array("foobar\ntest\nyes", array(
+ 'question_text' => '',
+ 'strict' => false,
+ 'lang_iso' => '',
+ 'answers' => array('foobar', 'test', 'yes')
+ )),
+ array("foobar\ntest\n \nyes", array(
+ 'question_text' => '',
+ 'strict' => false,
+ 'lang_iso' => '',
+ 'answers' => array(
+ 0 => 'foobar',
+ 1 => 'test',
+ 3 => 'yes',
+ )
+ )),
+ array('', array(
+ 'question_text' => '',
+ 'strict' => false,
+ 'lang_iso' => '',
+ 'answers' => '',
+ )),
+ );
+ }
+
+ /**
+ * @dataProvider data_acp_get_question_input
+ */
+ public function test_acp_get_question_input($value, $expected)
+ {
+ $this->request->overwrite('answers', $value);
+
+ $this->assertEquals($expected, $this->qa->acp_get_question_input());
+ }
+}
diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php
index 6723e3bc52..ff1af8119b 100644
--- a/tests/controller/common_helper_route.php
+++ b/tests/controller/common_helper_route.php
@@ -51,6 +51,11 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
return '/app.php';
}
+ protected function get_base_uri()
+ {
+ return $this->get_uri();
+ }
+
protected function get_script_name()
{
return 'app.php';
@@ -66,7 +71,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
$this->request = new phpbb_mock_request();
$this->request->overwrite('SCRIPT_NAME', $this->get_uri(), \phpbb\request\request_interface::SERVER);
$this->request->overwrite('SCRIPT_FILENAME', $this->get_script_name(), \phpbb\request\request_interface::SERVER);
- $this->request->overwrite('REQUEST_URI', $this->get_uri(), \phpbb\request\request_interface::SERVER);
+ $this->request->overwrite('REQUEST_URI', $this->get_base_uri(), \phpbb\request\request_interface::SERVER);
$this->request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER);
$this->request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER);
diff --git a/tests/controller/helper_route_slash_test.php b/tests/controller/helper_route_slash_test.php
new file mode 100644
index 0000000000..3db5ec19e5
--- /dev/null
+++ b/tests/controller/helper_route_slash_test.php
@@ -0,0 +1,43 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/common_helper_route.php';
+
+class phpbb_controller_helper_route_slash_test extends phpbb_controller_common_helper_route
+{
+ protected function get_phpbb_root_path()
+ {
+ return './../';
+ }
+
+ protected function get_uri()
+ {
+ return '/phpBB3/app.php';
+ }
+
+ protected function get_base_uri()
+ {
+ return '/phpBB3/';
+ }
+
+ protected function get_script_name()
+ {
+ return 'app.php';
+ }
+
+ protected function path_to_app()
+ {
+ return 'phpBB3/';
+ }
+}
diff --git a/tests/event/fixtures/adm/style/acp_bbcodes.html b/tests/event/fixtures/adm/style/acp_bbcodes.html
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/event/fixtures/adm/style/acp_bbcodes.html
diff --git a/tests/event/fixtures/normal_events.md.test b/tests/event/fixtures/normal_events.md.test
new file mode 100644
index 0000000000..47921c4e57
--- /dev/null
+++ b/tests/event/fixtures/normal_events.md.test
@@ -0,0 +1,20 @@
+acp_bbcodes_actions_append
+===
+* Location: adm/style/acp_bbcodes.html
+* Since: 3.1.0-a3
+* Changed: 3.1.0-a4
+* Purpose: desc1
+
+acp_bbcodes_actions_prepend
+===
+* Location: adm/style/acp_bbcodes.html
+* Since: 3.1.0-a5
+* Purpose: desc2
+
+acp_bbcodes_actions_prepend2
+===
+* Location: adm/style/acp_bbcodes.html
+* Since: 3.1.0-a4
+* Changed: 3.1.0-a5 Moved up
+* Changed: 3.1.0-a6 Moved down
+* Purpose: desc2
diff --git a/tests/event/md_exporter_test.php b/tests/event/md_exporter_test.php
index 0f9d855caa..1a51204cbe 100644
--- a/tests/event/md_exporter_test.php
+++ b/tests/event/md_exporter_test.php
@@ -11,21 +11,110 @@
*
*/
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+
class phpbb_event_md_exporter_test extends phpbb_test_case
{
-
static public function crawl_eventsmd_data()
{
return array(
+ array('normal_events.md.test', null, null, array(
+ 'acp_bbcodes_actions_append' => array(
+ 'event' => 'acp_bbcodes_actions_append',
+ 'files' => array(
+ 'prosilver' => array(),
+ 'subsilver2' => array(),
+ 'adm' => array('acp_bbcodes.html'),
+ ),
+ 'since' => '3.1.0-a3',
+ 'changed' => array(
+ '3.1.0-a4' => '',
+ ),
+ 'description' => 'desc1' . "\n",
+ ),
+ 'acp_bbcodes_actions_prepend' => array(
+ 'event' => 'acp_bbcodes_actions_prepend',
+ 'files' => array(
+ 'prosilver' => array(),
+ 'subsilver2' => array(),
+ 'adm' => array('acp_bbcodes.html'),
+ ),
+ 'since' => '3.1.0-a5',
+ 'changed' => array(),
+ 'description' => 'desc2' . "\n",
+ ),
+ 'acp_bbcodes_actions_prepend2' => array(
+ 'event' => 'acp_bbcodes_actions_prepend2',
+ 'files' => array(
+ 'prosilver' => array(),
+ 'subsilver2' => array(),
+ 'adm' => array('acp_bbcodes.html'),
+ ),
+ 'since' => '3.1.0-a4',
+ 'changed' => array(
+ '3.1.0-a5' => 'Moved up',
+ '3.1.0-a6' => 'Moved down',
+ ),
+ 'description' => 'desc2' . "\n",
+ ),
+ )),
+ array('normal_events.md.test', '3.1.0-a5', '3.1.0-a5', array(
+ 'acp_bbcodes_actions_prepend' => array(
+ 'event' => 'acp_bbcodes_actions_prepend',
+ 'files' => array(
+ 'prosilver' => array(),
+ 'subsilver2' => array(),
+ 'adm' => array('acp_bbcodes.html'),
+ ),
+ 'since' => '3.1.0-a5',
+ 'changed' => array(),
+ 'description' => 'desc2' . "\n",
+ ),
+ 'acp_bbcodes_actions_prepend2' => array(
+ 'event' => 'acp_bbcodes_actions_prepend2',
+ 'files' => array(
+ 'prosilver' => array(),
+ 'subsilver2' => array(),
+ 'adm' => array('acp_bbcodes.html'),
+ ),
+ 'since' => '3.1.0-a4',
+ 'changed' => array(
+ '3.1.0-a5' => 'Moved up',
+ '3.1.0-a6' => 'Moved down',
+ ),
+ 'description' => 'desc2' . "\n",
+ ),
+ )),
+ );
+ }
+
+ /**
+ * @dataProvider crawl_eventsmd_data
+ *
+ * @param string $file
+ * @param string $min_version
+ * @param string $max_version
+ * @param array $events
+ */
+ public function test_crawl_eventsmd($file, $min_version, $max_version, $events)
+ {
+ $exporter = new \phpbb\event\md_exporter(dirname(__FILE__) . '/fixtures/', null, $min_version, $max_version);
+ $this->assertSame(sizeof($events), $exporter->crawl_eventsmd($file, 'adm'));
+ $this->assertEquals($events, $exporter->get_events());
+ }
+
+ static public function crawl_phpbb_eventsmd_data()
+ {
+ return array(
array('styles'),
array('adm'),
);
}
/**
- * @dataProvider crawl_eventsmd_data
- */
- public function test_crawl_eventsmd($filter)
+ * @dataProvider crawl_phpbb_eventsmd_data
+ */
+ public function test_crawl_phpbb_eventsmd($filter)
{
global $phpbb_root_path;
$exporter = new \phpbb\event\md_exporter($phpbb_root_path);
diff --git a/tests/functional/acp_attachments_test.php b/tests/functional/acp_attachments_test.php
new file mode 100644
index 0000000000..8e810a508a
--- /dev/null
+++ b/tests/functional/acp_attachments_test.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+/**
+ * @group functional
+ */
+class phpbb_functional_acp_attachments_test extends phpbb_functional_test_case
+{
+ public function data_imagick_path_linux()
+ {
+ return array(
+ array('/usr/bin', 'Configuration updated successfully'),
+ array('/usr/foobar', 'The entered path “/usr/foobar” does not exist.'),
+ array('/usr/bin/which', 'The entered path “/usr/bin/which” is not a directory.'),
+ );
+ }
+
+ /**
+ * @dataProvider data_imagick_path_linux
+ */
+ public function test_imagick_path_linux($imagick_path, $expected)
+ {
+ if (strtolower(substr(PHP_OS, 0, 5)) !== 'linux')
+ {
+ $this->markTestSkipped('Unable to test linux specific paths on other OS.');
+ }
+
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', 'adm/index.php?i=attachments&mode=attach&sid=' . $this->sid);
+
+ $form = $crawler->selectButton('Submit')->form(array('config[img_imagick]' => $imagick_path));
+
+ $crawler = self::submit($form);
+ $this->assertContains($expected, $crawler->filter('#main')->text());
+ }
+
+ public function data_imagick_path_windows()
+ {
+ return array(
+ array('C:\Windows', 'Configuration updated successfully'),
+ array('C:\Windows\foobar1', 'The entered path “C:\Windows\foobar1” does not exist.'),
+ array('C:\Windows\explorer.exe', 'The entered path “C:\Windows\explorer.exe” is not a directory.'),
+ );
+ }
+
+ /**
+ * @dataProvider data_imagick_path_windows
+ */
+ public function test_imagick_path_windows($imagick_path, $expected)
+ {
+ if (strtolower(substr(PHP_OS, 0, 3)) !== 'win')
+ {
+ $this->markTestSkipped('Unable to test windows specific paths on other OS.');
+ }
+
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', 'adm/index.php?i=attachments&mode=attach&sid=' . $this->sid);
+
+ $form = $crawler->selectButton('Submit')->form(array('config[img_imagick]' => $imagick_path));
+
+ $crawler = self::submit($form);
+ $this->assertContains($expected, $crawler->filter('#main')->text());
+ }
+}
diff --git a/tests/functional/visibility_softdelete_test.php b/tests/functional/visibility_softdelete_test.php
index 794f0cde68..39efc99a35 100644
--- a/tests/functional/visibility_softdelete_test.php
+++ b/tests/functional/visibility_softdelete_test.php
@@ -42,6 +42,19 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'forum_perm_from' => 2,
));
$crawler = self::submit($form);
+
+ // Create second user which does not have m_delete permission
+ $this->add_lang('acp/permissions');
+
+ $second_user = $this->create_user('no m_delete moderator');
+ $this->add_user_group("GLOBAL_MODERATORS", 'no m_delete moderator', true);
+
+ // Set m_delete to never
+ $crawler = self::request('GET', "adm/index.php?i=acp_permissions&icat=16&mode=setting_user_global&user_id[0]=$second_user&type=m_&sid={$this->sid}");
+ $form = $crawler->selectButton($this->lang('APPLY_PERMISSIONS'))->form();
+ $data = array("setting[$second_user][0][m_delete]" => ACL_NEVER);
+ $form->setValues($data);
+ $crawler = self::submit($form);
}
public function test_create_post()
@@ -98,6 +111,23 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'forum_topics_softdeleted' => 0,
'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'],
), 'after replying');
+
+ // Test creating another reply
+ $post3 = $this->create_post($this->data['forums']['Soft Delete #1'], $post['topic_id'], 'Re: Soft Delete Topic #1-#3', 'This is another test post posted by the testing framework.');
+ $crawler = self::request('GET', "viewtopic.php?t={$post3['topic_id']}&sid={$this->sid}");
+
+ $this->assertContains('Re: Soft Delete Topic #1-#3', $crawler->filter('html')->text());
+ $this->data['posts']['Re: Soft Delete Topic #1-#3'] = (int) $post3['post_id'];
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 3,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#3'],
+ ), 'after replying a second time');
}
public function test_softdelete_post()
@@ -114,21 +144,22 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'posts' => array(
'Soft Delete Topic #1',
'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3',
),
));
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
- 'forum_posts_approved' => 2,
+ 'forum_posts_approved' => 3,
'forum_posts_unapproved' => 0,
'forum_posts_softdeleted' => 0,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
- 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'],
+ 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#3'],
), 'before softdelete');
$this->add_lang('posting');
- $crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Soft Delete #1']}&p={$this->data['posts']['Re: Soft Delete Topic #1-#2']}&sid={$this->sid}");
+ $crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Soft Delete #1']}&p={$this->data['posts']['Re: Soft Delete Topic #1-#3']}&sid={$this->sid}");
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
$form = $crawler->selectButton('Yes')->form();
@@ -136,19 +167,69 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assertContainsLang('POST_DELETED', $crawler->text());
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
- 'forum_posts_approved' => 1,
+ 'forum_posts_approved' => 2,
'forum_posts_unapproved' => 0,
'forum_posts_softdeleted' => 1,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
- 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'],
), 'after softdelete');
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
$this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text());
}
+ public function test_softdelete_post_no_m_delete()
+ {
+ $this->login('no m_delete moderator');
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 2,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'],
+ ), 'before softdelete without m_delete');
+
+ $this->add_lang('posting');
+ $crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Soft Delete #1']}&p={$this->data['posts']['Re: Soft Delete Topic #1-#2']}&sid={$this->sid}");
+ $this->assertNotContainsLang('DELETE_PERMANENTLY', $crawler->text());
+
+ $form = $crawler->selectButton('Yes')->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang('POST_DELETED', $crawler->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 2,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after softdelete without m_delete');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+ $this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text());
+ }
+
public function test_move_softdeleted_post()
{
$this->login();
@@ -163,13 +244,14 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'posts' => array(
'Soft Delete Topic #1',
'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3',
),
));
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
@@ -212,7 +294,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
@@ -234,6 +316,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'posts' => array(
'Soft Delete Topic #1',
'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3'
),
));
@@ -250,7 +333,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
@@ -283,7 +366,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
'forum_posts_approved' => 0,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 2,
+ 'forum_posts_softdeleted' => 3,
'forum_topics_approved' => 0,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 1,
@@ -305,6 +388,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'posts' => array(
'Soft Delete Topic #1',
'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3'
),
));
@@ -321,7 +405,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
'forum_posts_approved' => 0,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 2,
+ 'forum_posts_softdeleted' => 3,
'forum_topics_approved' => 0,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 1,
@@ -344,7 +428,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 0,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 2,
+ 'forum_posts_softdeleted' => 3,
'forum_topics_approved' => 0,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 1,
@@ -376,13 +460,14 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'posts' => array(
'Soft Delete Topic #1',
'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3'
),
));
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 0,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 2,
+ 'forum_posts_softdeleted' => 3,
'forum_topics_approved' => 0,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 1,
@@ -417,7 +502,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
@@ -449,13 +534,14 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'posts' => array(
'Soft Delete Topic #1',
'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3'
),
));
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
@@ -495,7 +581,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 0,
+ 'forum_posts_softdeleted' => 1,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
@@ -528,6 +614,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'posts' => array(
'Soft Delete Topic #1',
'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3'
),
));
@@ -539,7 +626,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 1,
@@ -562,13 +649,14 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'posts' => array(
'Soft Delete Topic #1',
'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3'
),
));
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 1,
@@ -603,7 +691,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
@@ -625,13 +713,14 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
'posts' => array(
'Soft Delete Topic #1',
'Re: Soft Delete Topic #1-#2',
+ 'Re: Soft Delete Topic #1-#3'
),
));
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
@@ -660,7 +749,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
@@ -670,11 +759,11 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
$this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
'forum_posts_approved' => 1,
'forum_posts_unapproved' => 0,
- 'forum_posts_softdeleted' => 1,
+ 'forum_posts_softdeleted' => 2,
'forum_topics_approved' => 1,
'forum_topics_unapproved' => 0,
'forum_topics_softdeleted' => 0,
- 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'] + 2,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'] + 3,
), 'after forking #2');
}
diff --git a/tests/functions/fixtures/user_delete.xml b/tests/functions/fixtures/user_delete.xml
new file mode 100644
index 0000000000..4c4479d29b
--- /dev/null
+++ b/tests/functions/fixtures/user_delete.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username_clean</column>
+ <column>username</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <row>
+ <value>1</value>
+ <value>anonymous</value>
+ <value>anonymous</value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>2</value>
+ <value>2</value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+ <table name="phpbb_oauth_accounts">
+ <column>user_id</column>
+ <column>provider</column>
+ <column>oauth_provider_id</column>
+ <row>
+ <value>2</value>
+ <value>google</value>
+ <value>1234567890123456789</value>
+ </row>
+ </table>
+ <table name="phpbb_oauth_tokens">
+ <column>user_id</column>
+ <column>session_id</column>
+ <column>provider</column>
+ <column>oauth_token</column>
+ <row>
+ <value>2</value>
+ <value>897a897b797c8789997d7979879</value>
+ <value>auth.provider.oauth.service.google</value>
+ <value>{"accessToken":"ya29.YPHwCWVkrvwu1kgbYKiDNYaQ451ZuHy9OEQAGVME8if-WBzR-v7a9ftxbx41kaL)5VLEXB-6qJEvri","endOfLife":1429959670,"extraParams":{"token_type":"Bearer","id_token":"eyJhbGciOiJSUzI1NiIsImupZCI6IjE0YuRjNzc2MDQwYjUyNDZmNTI5OWFkZDVlMmQ1NWNOPTdjMDdlZTAifQ.eyJpc3MiOiJhY2NvdW90cy5nb78nbGUuY29tIiwic3ViIjoiMTExMDMwNwerNjM4MTM5NTQwMTM1IiwiYXpwIjoiOTk3MzUwMTY0NzE0LWhwOXJrYjZpcjM4MW80YjV1NjRpaGtmM29zMnRvbWxhLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZW1haWwiOiJtYXJjLmFsZXhhbmRlci4zN0BnbWFpbC5jb20iLCJhdF9oYXNoIjoiWHk2b1JabnVZUWRfRTZDeDV0RkItdyIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJhdWQiOiI5OTczNTAxNjQ3MTQtaHA5cmtiNmlyMzgxbzRiNXU2NGloa2Yzb3MydG9tbGEuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJpYXQiOjE0Mjk5NTYwNzEsImV4cCI6MTQyOTk1OTY3MX0.C5gfSzjqwlRRvVMuTP6jfWIuEHMXn55oYHsSA3eh97n2BZL0TZHhUm4K206Fgucd6ufAphan4l0J7y6tMAHLZPr-kk6KDINxWnPG-up99reblGutay0lRYjMCcrhJAOql8EI1bi84GyliZFYHL67pE0ZtSf-CMb1CeH18TFe-Fk"},"refreshToken":null,"token_class":"OAuth\\\\OAuth2\\\\Token\\\\StdOAuth2Token"}</value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php
new file mode 100644
index 0000000000..db52dcded7
--- /dev/null
+++ b/tests/functions/user_delete_test.php
@@ -0,0 +1,112 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php';
+
+class phpbb_functions_user_delete_test extends phpbb_database_test_case
+{
+ /** @var \phpbb\db\driver\driver_interface */
+ protected $db;
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_delete.xml');
+ }
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ global $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user;
+
+ $this->db = $db = $this->new_dbal();
+ $user = new \phpbb\user('\phpbb\datetime');
+ $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
+ $phpbb_container = new phpbb_mock_container_builder();
+ $config = new \phpbb\config\config(array(
+ 'auth_method' => 'oauth',
+ 'auth_oauth_google_key' => 'foo',
+ 'auth_oauth_google_secret' => 'bar',
+ ));
+ set_config_count('foobar', 0, false, $config);
+ $cache = new \phpbb\cache\driver\null();
+ $request = new phpbb_mock_request();
+ $notification_manager = new phpbb_mock_notification_manager();
+ $provider_collection = new \phpbb\auth\provider_collection($phpbb_container, $config);
+ $oauth_provider_google = new \phpbb\auth\provider\oauth\service\google($config, $request);
+ $oauth_provider_collection = new \phpbb\di\service_collection($phpbb_container);
+ $oauth_provider_collection->offsetSet('auth.provider.oauth.service.google', $oauth_provider_google);
+
+ $driver_helper = new \phpbb\passwords\driver\helper($config);
+ $passwords_drivers = array(
+ 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper),
+ 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $driver_helper),
+ 'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $driver_helper),
+ 'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $driver_helper),
+ );
+
+ $passwords_helper = new \phpbb\passwords\helper;
+ // Set up passwords manager
+ $passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers));
+
+ $oauth_provider = new \phpbb\auth\provider\oauth\oauth(
+ $db,
+ $config,
+ $passwords_manager,
+ $request,
+ $user,
+ 'phpbb_oauth_tokens',
+ 'phpbb_oauth_accounts',
+ $oauth_provider_collection,
+ 'phpbb_users',
+ $phpbb_container,
+ $this->phpbb_root_path,
+ $this->php_ext
+ );
+ $provider_collection->offsetSet('auth.provider.oauth', $oauth_provider);
+
+ $phpbb_container->set('auth.provider.oauth', $oauth_provider);
+ $phpbb_container->set('auth.provider.oauth.service.google', $oauth_provider_google);
+ $phpbb_container->set('auth.provider_collection', $provider_collection);
+ $phpbb_container->set('notification_manager', $notification_manager);
+ }
+
+ public function test_user_delete()
+ {
+ // Check that user is linked
+ $sql = 'SELECT ot.user_id AS user_id
+ FROM phpbb_oauth_accounts oa, phpbb_oauth_tokens ot
+ WHERE oa.user_id = 2
+ AND ot.user_id = oa.user_id';
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ $this->assertEquals(array('user_id' => '2'), $row);
+
+ // user_delete() should return false
+ $this->assertFalse(user_delete('remove', array(2)));
+
+ // Make sure user link was removed
+ $sql = 'SELECT ot.user_id AS user_id
+ FROM phpbb_oauth_accounts oa, phpbb_oauth_tokens ot
+ WHERE oa.user_id = 2
+ AND ot.user_id = oa.user_id';
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ $this->assertEmpty($row);
+ }
+}
diff --git a/tests/functions_acp/build_cfg_template_test.php b/tests/functions_acp/build_cfg_template_test.php
index 8ae78b97db..a8d7ae6f09 100644
--- a/tests/functions_acp/build_cfg_template_test.php
+++ b/tests/functions_acp/build_cfg_template_test.php
@@ -32,7 +32,7 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
array('config_key_name' => '2'),
'config_key_name',
array(),
- '<input id="key_name" type="password" size="20" maxlength="128" name="config[config_key_name]" value="2" autocomplete="off" />',
+ '<input id="key_name" type="password" size="20" maxlength="128" name="config[config_key_name]" value="********" autocomplete="off" />',
),
array(
array('text', 0, 255),
diff --git a/tests/functions_acp/validate_config_vars_test.php b/tests/functions_acp/validate_config_vars_test.php
index 3c9af4a889..32738e4351 100644
--- a/tests/functions_acp/validate_config_vars_test.php
+++ b/tests/functions_acp/validate_config_vars_test.php
@@ -162,4 +162,100 @@ class phpbb_functions_acp_validate_config_vars_test extends phpbb_test_case
$this->assertEquals($expected, $phpbb_error);
}
+
+ public function data_validate_path_linux()
+ {
+ return array(
+ array('/usr/bin', 'absolute_path', true),
+ array('/usr/bin/', 'absolute_path:50:200', true),
+ array('/usr/bin/which', 'absolute_path', 'DIRECTORY_NOT_DIR'),
+ array('/foo/bar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'),
+ array('C:\Windows', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'),
+ array('.', 'absolute_path', true),
+ array('', 'absolute_path', true),
+ array('mkdir /foo/bar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'),
+ // Make sure above command didn't do anything
+ array('/foo/bar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'),
+ );
+ }
+
+ /**
+ * @dataProvider data_validate_path_linux
+ */
+ public function test_validate_path_linux($path, $validation_type, $expected)
+ {
+ if (strtolower(substr(PHP_OS, 0, 5)) !== 'linux')
+ {
+ $this->markTestSkipped('Unable to test linux specific paths on other OS.');
+ }
+
+ $error = array();
+ $config_ary = array(
+ 'path' => $path,
+ );
+
+ validate_config_vars(array(
+ 'path' => array('lang' => 'FOOBAR', 'validate' => $validation_type),
+ ),
+ $config_ary,
+ $error
+ );
+
+ if ($expected === true)
+ {
+ $this->assertEmpty($error);
+ }
+ else
+ {
+ $this->assertEquals(array($expected), $error);
+ }
+ }
+
+ public function data_validate_path_windows()
+ {
+ return array(
+ array('C:\Windows', 'absolute_path', true),
+ array('C:\Windows\\', 'absolute_path:50:200', true),
+ array('C:\Windows\explorer.exe', 'absolute_path', 'DIRECTORY_NOT_DIR'),
+ array('C:\foobar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'),
+ array('/usr/bin', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'),
+ array('.', 'absolute_path', true),
+ array('', 'absolute_path', true),
+ array('mkdir C:\Windows\foobar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'),
+ // Make sure above command didn't do anything
+ array('C:\Windows\foobar', 'absolute_path', 'DIRECTORY_DOES_NOT_EXIST'),
+ );
+ }
+
+ /**
+ * @dataProvider data_validate_path_windows
+ */
+ public function test_validate_path_windows($path, $validation_type, $expected)
+ {
+ if (strtolower(substr(PHP_OS, 0, 3)) !== 'win')
+ {
+ $this->markTestSkipped('Unable to test windows specific paths on other OS.');
+ }
+
+ $error = array();
+ $config_ary = array(
+ 'path' => $path,
+ );
+
+ validate_config_vars(array(
+ 'path' => array('lang' => 'FOOBAR', 'validate' => $validation_type),
+ ),
+ $config_ary,
+ $error
+ );
+
+ if ($expected === true)
+ {
+ $this->assertEmpty($error);
+ }
+ else
+ {
+ $this->assertEquals(array($expected), $error);
+ }
+ }
}
diff --git a/tests/functions_user/delete_user_test.php b/tests/functions_user/delete_user_test.php
index d5c78c64ad..7db69e332c 100644
--- a/tests/functions_user/delete_user_test.php
+++ b/tests/functions_user/delete_user_test.php
@@ -38,6 +38,16 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
$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(
+ 'auth.provider.db',
+ new phpbb_mock_auth_provider()
+ );
+ $provider_collection = new \phpbb\auth\provider_collection($phpbb_container, $config);
+ $provider_collection->add('auth.provider.db');
+ $phpbb_container->set(
+ 'auth.provider_collection',
+ $provider_collection
+ );
}
public function first_last_post_data()
diff --git a/tests/lint_test.php b/tests/lint_test.php
index 9fb1c7624c..70046bdfd2 100644
--- a/tests/lint_test.php
+++ b/tests/lint_test.php
@@ -38,31 +38,34 @@ class phpbb_lint_test extends phpbb_test_case
self::markTestSkipped(sprintf('Could not run PHP_BINARY %s. Output: %s', self::$php_binary, $output));
}
}
-
- self::$exclude = array(
- dirname(__FILE__) . '/../.git',
- dirname(__FILE__) . '/../build/new_version',
- dirname(__FILE__) . '/../build/old_versions',
- dirname(__FILE__) . '/../phpBB/cache',
- // PHP Fatal error: Cannot declare class Container because the name is already in use in /var/www/projects/phpbb3/tests/../phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php on line 20
- // https://gist.github.com/e003913ffd493da63cbc
- dirname(__FILE__) . '/../phpBB/vendor',
- );
}
- public function test_lint()
+ /**
+ * @dataProvider lint_data
+ */
+ public function test_lint($path)
{
if (version_compare(PHP_VERSION, '5.3.0', '<'))
{
$this->markTestSkipped('phpBB uses PHP 5.3 syntax in some files, linting on PHP < 5.3 will fail');
}
- $root = dirname(__FILE__) . '/..';
- $this->check($root);
+ $cmd = sprintf('(%s -l %s) 2>&1', self::$php_binary, escapeshellarg($path));
+ $output = array();
+ $status = 1;
+ exec($cmd, $output, $status);
+ $output = implode("\n", $output);
+ $this->assertEquals(0, $status, "PHP lint failed for $path:\n$output");
+ }
+
+ public function lint_data()
+ {
+ return $this->check(dirname(__FILE__) . '/..');
}
protected function check($root)
{
+ $files = array();
$dh = opendir($root);
while (($filename = readdir($dh)) !== false)
{
@@ -76,19 +79,25 @@ class phpbb_lint_test extends phpbb_test_case
{
continue;
}
- if (is_dir($path) && !in_array($path, self::$exclude))
+ if (is_dir($path) && !in_array($path, array(
+ dirname(__FILE__) . '/../.git',
+ dirname(__FILE__) . '/../build/new_version',
+ dirname(__FILE__) . '/../build/old_versions',
+ dirname(__FILE__) . '/../phpBB/cache',
+ dirname(__FILE__) . '/../phpBB/ext',
+ dirname(__FILE__) . '/../phpBB/store',
+ // PHP Fatal error: Cannot declare class Container because the name is already in use in /var/www/projects/phpbb3/tests/../phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php on line 20
+ // https://gist.github.com/e003913ffd493da63cbc
+ dirname(__FILE__) . '/../phpBB/vendor',
+ )))
{
- $this->check($path);
+ $files = array_merge($files, $this->check($path));
}
else if (substr($filename, strlen($filename)-4) == '.php')
{
- $cmd = sprintf('(%s -l %s) 2>&1', self::$php_binary, escapeshellarg($path));
- $output = array();
- $status = 1;
- exec($cmd, $output, $status);
- $output = implode("\n", $output);
- $this->assertEquals(0, $status, "PHP lint failed for $path:\n$output");
+ $files[] = array($path);
}
}
+ return $files;
}
}
diff --git a/tests/plupload/plupload_test.php b/tests/plupload/plupload_test.php
new file mode 100644
index 0000000000..2f47bf2b39
--- /dev/null
+++ b/tests/plupload/plupload_test.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+class phpbb_plupload_test extends phpbb_test_case
+{
+ public function generate_resize_string_data()
+ {
+ return array(
+ array(
+ 0,
+ 0,
+ '',
+ ),
+ array(
+ 130,
+ 150,
+ 'resize: {width: 130, height: 150, quality: 100},'
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider generate_resize_string_data
+ */
+ public function test_generate_resize_string($config_width, $config_height, $expected)
+ {
+ $config = new \phpbb\config\config(array(
+ 'img_max_width' => $config_width,
+ 'img_max_height' => $config_height,
+ 'upload_path' => 'files',
+ ));
+ $plupload = new \phpbb\plupload\plupload(
+ '',
+ $config,
+ new phpbb_mock_request,
+ new \phpbb\user('\phpbb\datetime'),
+ new \phpbb\php\ini,
+ new \phpbb\mimetype\guesser(array(new \phpbb\mimetype\extension_guesser))
+ );
+
+ $this->assertEquals($expected, $plupload->generate_resize_string());
+ }
+}
diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php
index da3f23bbf4..3a791f5e81 100644
--- a/tests/search/mysql_test.php
+++ b/tests/search/mysql_test.php
@@ -40,6 +40,6 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$error = null;
$class = self::get_search_wrapper('\phpbb\search\fulltext_mysql');
- $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $phpbb_dispatcher, $user);
+ $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user, $phpbb_dispatcher);
}
}
diff --git a/tests/search/native_test.php b/tests/search/native_test.php
index cf65a4a4de..29d0d0a8d3 100644
--- a/tests/search/native_test.php
+++ b/tests/search/native_test.php
@@ -38,7 +38,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
$class = self::get_search_wrapper('\phpbb\search\fulltext_native');
$config['fulltext_native_min_chars'] = 2;
$config['fulltext_native_max_chars'] = 14;
- $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $phpbb_dispatcher, $user);
+ $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user, $phpbb_dispatcher);
}
public function keywords()
diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php
index ece99b4500..97cca0e70c 100644
--- a/tests/search/postgres_test.php
+++ b/tests/search/postgres_test.php
@@ -40,6 +40,6 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$error = null;
$class = self::get_search_wrapper('\phpbb\search\fulltext_postgres');
- $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $phpbb_dispatcher, $user);
+ $this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user, $phpbb_dispatcher);
}
}
diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php
index 21fb103ed1..a88fc63858 100644
--- a/tests/security/redirect_test.php
+++ b/tests/security/redirect_test.php
@@ -23,9 +23,9 @@ class phpbb_security_redirect_test extends phpbb_security_test_base
{
// array(Input -> redirect(), expected triggered error (else false), expected returned result url (else false))
return array(
- array('data://x', false, false, 'http://localhost/phpBB'),
+ array('data://x', false, 'INSECURE_REDIRECT', false),
array('bad://localhost/phpBB/index.php', false, 'INSECURE_REDIRECT', false),
- array('http://www.otherdomain.com/somescript.php', false, false, 'http://localhost/phpBB'),
+ array('http://www.otherdomain.com/somescript.php', false, 'INSECURE_REDIRECT', false),
array("http://localhost/phpBB/memberlist.php\n\rConnection: close", false, 'INSECURE_REDIRECT', false),
array('javascript:test', false, false, 'http://localhost/phpBB/javascript:test'),
array('http://localhost/phpBB/index.php;url=', false, 'INSECURE_REDIRECT', false),
@@ -51,6 +51,11 @@ class phpbb_security_redirect_test extends phpbb_security_test_base
array('../index.php', false, false, 'http://localhost/index.php'),
array('../index.php', true, false, 'http://localhost/index.php'),
array('./index.php', false, false, 'http://localhost/phpBB/index.php'),
+ array('https://foobar.com\@http://localhost/phpBB', false, 'INSECURE_REDIRECT', false),
+ array('https://foobar.com\@localhost/troll/http://localhost/', false, 'INSECURE_REDIRECT', false),
+ array('http://localhost.foobar.com\@localhost/troll/http://localhost/', false, 'INSECURE_REDIRECT', false),
+ array('http://localhost/phpBB', false, false, 'http://localhost/phpBB'),
+ array('http://localhost/phpBB/', false, false, 'http://localhost/phpBB/'),
);
}
@@ -105,7 +110,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base
if ($expected_error !== false)
{
- $this->setExpectedTriggerError(E_USER_ERROR, $expected_error);
+ $this->setExpectedTriggerError(E_USER_ERROR, $user->lang[$expected_error]);
}
$result = redirect($test, true, $disable_cd_check);
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index b6769f08d0..844caa8f54 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -410,6 +410,18 @@ class phpbb_functional_test_case extends phpbb_test_case
$form = $crawler->selectButton('Enable')->form();
$crawler = self::submit($form);
$this->add_lang('acp/extensions');
+
+ $meta_refresh = $crawler->filter('meta[http-equiv="refresh"]');
+
+ // Wait for extension to be fully enabled
+ while (sizeof($meta_refresh))
+ {
+ preg_match('#url=.+/(adm+.+)#', $meta_refresh->attr('content'), $match);
+ $url = $match[1];
+ $crawler = self::request('POST', $url);
+ $meta_refresh = $crawler->filter('meta[http-equiv="refresh"]');
+ }
+
$this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $crawler->filter('div.successbox')->text());
$this->logout();
diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php
index 05547dcd00..ed28bcb38f 100644
--- a/tests/upload/filespec_test.php
+++ b/tests/upload/filespec_test.php
@@ -213,6 +213,8 @@ class phpbb_filespec_test extends phpbb_test_case
array('file.phpbb.gif', 'gif'),
array('file..', ''),
array('.file..jpg.webp', 'webp'),
+ array('/test.com/file', ''),
+ array('/test.com/file.gif', 'gif'),
);
}
diff --git a/travis/check-image-icc-profiles.sh b/travis/check-image-icc-profiles.sh
index bb070ccc27..5926962d40 100755
--- a/travis/check-image-icc-profiles.sh
+++ b/travis/check-image-icc-profiles.sh
@@ -15,6 +15,6 @@ TRAVIS_PHP_VERSION=$2
if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ]
then
- find . -type f -not -path './phpBB/vendor/*' -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' | \
+ find . -type f -a -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' -a -not -wholename '*vendor/*' | \
parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}'
fi
diff --git a/travis/phpunit-mysqli-travis.xml b/travis/phpunit-mysqli-travis.xml
index 4c963895fc..b12ae6fe8b 100644
--- a/travis/phpunit-mysqli-travis.xml
+++ b/travis/phpunit-mysqli-travis.xml
@@ -18,9 +18,6 @@
<exclude>../tests/lint_test.php</exclude>
<exclude>../tests/ui</exclude>
</testsuite>
- <testsuite name="phpBB Lint Test">
- <file>../tests/lint_test.php</file>
- </testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory>
</testsuite>
diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh
index ab045431cc..911ba12f3c 100755
--- a/travis/setup-webserver.sh
+++ b/travis/setup-webserver.sh
@@ -11,12 +11,6 @@
set -e
set -x
-if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ]
-then
- # Add PPA providing dependencies for recent HHVM on Ubuntu 12.04.
- sudo add-apt-repository -y ppa:mapnik/boost
-fi
-
sudo apt-get update
sudo apt-get install -y nginx realpath
@@ -30,11 +24,9 @@ APP_SOCK=$(realpath "$DIR")/php-app.sock
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ]
then
- # Upgrade to a recent stable version of HHVM
- sudo apt-get -o Dpkg::Options::="--force-confnew" install -y hhvm-nightly
-
HHVM_LOG=$(realpath "$DIR")/hhvm.log
+ sudo service hhvm stop
sudo hhvm \
--mode daemon \
--user "$USER" \