mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge branch 'develop' into ticket/10820-develop
# By Joas Schilling (146) and others # Via Andreas Fischer (50) and others * develop: (356 commits) [ticket/11599] Copy the forums into a static array for later reuse [ticket/11602] Do not call localize_errors() if avatars are disabled [ticket/11601] Add protected method for database sync and call it [ticket/11601] Split post_setup_synchronisation logic from xml parsing [ticket/11550] Specify a valid path so it's clearer that it must be a path [ticket/11550] Move comments to correct function [ticket/11550] We use a different fixture set for extension_acp_test.php [ticket/11550] Fixtures should only be directories not files [ticket/11550] Use new functionality from the test case helpers [ticket/11550] Move functionality for copying/restoring to test case helpers [ticket/11550] Fix copying the fixtures in extension_permission_lang_test.php [ticket/11543] Add more users so #hidden <> #normal [ticket/11590] Close database connections when tearDown() is called [ticket/develop/11543] Use plurals in develop [ticket/11543] Use correct IP addresses and inject time for correct values [ticket/11543] Add unit tests for obtain_users_online_string() [ticket/11543] Add unit tests for obtain_users_online() with empty forum [ticket/11543] Add unit tests for obtain_users_online() [ticket/11543] Add unit tests for obtain_guest_count() [ticket/11481] Move prepended slash from calls into function ...
This commit is contained in:
commit
e8b535bf9b
260 changed files with 9043 additions and 2949 deletions
11
.travis.yml
11
.travis.yml
|
@ -9,25 +9,18 @@ env:
|
||||||
- DB=mysql
|
- DB=mysql
|
||||||
- DB=postgres
|
- DB=postgres
|
||||||
|
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- php: 5.5
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi"
|
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi"
|
||||||
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi"
|
- sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi"
|
||||||
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi"
|
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi"
|
||||||
- travis/install-php-extensions.sh
|
- travis/install-php-extensions.sh
|
||||||
- pyrus set auto_discover 1
|
|
||||||
- pyrus install --force phpunit/DbUnit
|
|
||||||
- phpenv rehash
|
|
||||||
- cd phpBB
|
- cd phpBB
|
||||||
- php ../composer.phar install --dev
|
- php ../composer.phar install --dev --no-interaction --prefer-source
|
||||||
- cd ..
|
- cd ..
|
||||||
- sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi"
|
- sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- phpunit --configuration travis/phpunit-$DB-travis.xml
|
- phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|
|
@ -56,7 +56,8 @@
|
||||||
|
|
||||||
<target name="test" depends="clean,prepare,composer">
|
<target name="test" depends="clean,prepare,composer">
|
||||||
<exec dir="."
|
<exec dir="."
|
||||||
command="phpunit --log-junit build/logs/phpunit.xml
|
command="phpBB/vendor/bin/phpunit
|
||||||
|
--log-junit build/logs/phpunit.xml
|
||||||
--coverage-clover build/logs/clover.xml
|
--coverage-clover build/logs/clover.xml
|
||||||
--coverage-html build/coverage"
|
--coverage-html build/coverage"
|
||||||
passthru="true" />
|
passthru="true" />
|
||||||
|
@ -64,7 +65,8 @@
|
||||||
|
|
||||||
<target name="test-slow" depends="clean,prepare,composer">
|
<target name="test-slow" depends="clean,prepare,composer">
|
||||||
<exec dir="."
|
<exec dir="."
|
||||||
command="phpunit --log-junit build/logs/phpunit.xml
|
command="phpBB/vendor/bin/phpunit
|
||||||
|
--log-junit build/logs/phpunit.xml
|
||||||
--configuration phpunit.xml.all
|
--configuration phpunit.xml.all
|
||||||
--group slow
|
--group slow
|
||||||
--coverage-clover build/logs/clover-slow.xml
|
--coverage-clover build/logs/clover-slow.xml
|
||||||
|
|
BIN
composer.phar
BIN
composer.phar
Binary file not shown.
|
@ -78,12 +78,12 @@ function work($pull_id, $remote)
|
||||||
add_remote($pull_user, 'phpbb3');
|
add_remote($pull_user, 'phpbb3');
|
||||||
run("git fetch $pull_user");
|
run("git fetch $pull_user");
|
||||||
run("git merge --no-ff $pull_user/$pull_branch");
|
run("git merge --no-ff $pull_user/$pull_branch");
|
||||||
run("phpunit");
|
run("phpBB/vendor/bin/phpunit");
|
||||||
|
|
||||||
run("git checkout develop");
|
run("git checkout develop");
|
||||||
run("git pull $remote develop");
|
run("git pull $remote develop");
|
||||||
run("git merge --no-ff develop-olympus");
|
run("git merge --no-ff develop-olympus");
|
||||||
run("phpunit");
|
run("phpBB/vendor/bin/phpunit");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'develop':
|
case 'develop':
|
||||||
|
@ -93,7 +93,7 @@ function work($pull_id, $remote)
|
||||||
add_remote($pull_user, 'phpbb3');
|
add_remote($pull_user, 'phpbb3');
|
||||||
run("git fetch $pull_user");
|
run("git fetch $pull_user");
|
||||||
run("git merge --no-ff $pull_user/$pull_branch");
|
run("git merge --no-ff $pull_user/$pull_branch");
|
||||||
run("phpunit");
|
run("phpBB/vendor/bin/phpunit");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -50,7 +50,6 @@ $module_id = request_var('i', '');
|
||||||
$mode = request_var('mode', '');
|
$mode = request_var('mode', '');
|
||||||
|
|
||||||
// Set custom style for admin area
|
// Set custom style for admin area
|
||||||
$phpbb_style->set_ext_dir_prefix('adm/');
|
|
||||||
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
|
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
|
||||||
$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
|
$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
|
||||||
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
|
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
|
||||||
|
|
|
@ -196,7 +196,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="extgroup_filesize">{L_MAX_EXTGROUP_FILESIZE}{L_COLON}</label></dt>
|
<dt><label for="extgroup_filesize">{L_MAX_EXTGROUP_FILESIZE}{L_COLON}</label></dt>
|
||||||
<dd><input type="text" id="extgroup_filesize" size="3" maxlength="15" name="max_filesize" value="{EXTGROUP_FILESIZE}" /> <select name="size_select">{S_EXT_GROUP_SIZE_OPTIONS}</select></dd>
|
<dd><input type="number" id="extgroup_filesize" size="3" maxlength="15" name="max_filesize" value="{EXTGROUP_FILESIZE}" /> <select name="size_select">{S_EXT_GROUP_SIZE_OPTIONS}</select></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="assigned_extensions">{L_ASSIGNED_EXTENSIONS}{L_COLON}</label></dt>
|
<dt><label for="assigned_extensions">{L_ASSIGNED_EXTENSIONS}{L_COLON}</label></dt>
|
||||||
|
@ -348,7 +348,7 @@
|
||||||
<td><a href="{orphan.U_FILE}">{orphan.REAL_FILENAME}</a></td>
|
<td><a href="{orphan.U_FILE}">{orphan.REAL_FILENAME}</a></td>
|
||||||
<td>{orphan.FILETIME}</td>
|
<td>{orphan.FILETIME}</td>
|
||||||
<td>{orphan.FILESIZE}</td>
|
<td>{orphan.FILESIZE}</td>
|
||||||
<td><strong>{L_ATTACH_ID}{L_COLON} </strong><input type="text" name="post_id[{orphan.ATTACH_ID}]" size="7" maxlength="10" value="{orphan.POST_ID}" /></td>
|
<td><strong>{L_ATTACH_ID}{L_COLON} </strong><input type="number" name="post_id[{orphan.ATTACH_ID}]" size="7" maxlength="10" value="{orphan.POST_ID}" /></td>
|
||||||
<td><input type="checkbox" class="radio" name="add[{orphan.ATTACH_ID}]" /></td>
|
<td><input type="checkbox" class="radio" name="add[{orphan.ATTACH_ID}]" /></td>
|
||||||
<td><input type="checkbox" class="radio" name="delete[{orphan.ATTACH_ID}]" /></td>
|
<td><input type="checkbox" class="radio" name="delete[{orphan.ATTACH_ID}]" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="avatar_gravatar_email">{L_GRAVATAR_AVATAR_EMAIL}{L_COLON}</label><br /><span>{L_GRAVATAR_AVATAR_EMAIL_EXPLAIN}</span></dt>
|
<dt><label for="avatar_gravatar_email">{L_GRAVATAR_AVATAR_EMAIL}{L_COLON}</label><br /><span>{L_GRAVATAR_AVATAR_EMAIL_EXPLAIN}</span></dt>
|
||||||
<dd><input type="text" name="avatar_gravatar_email" id="avatar_gravatar_email" value="{AVATAR_GRAVATAR_EMAIL}" class="inputbox" /></dd>
|
<dd><input type="email" name="avatar_gravatar_email" id="avatar_gravatar_email" value="{AVATAR_GRAVATAR_EMAIL}" class="inputbox" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="avatar_gravatar_width">{L_GRAVATAR_AVATAR_SIZE}{L_COLON}</label><br /><span>{L_GRAVATAR_AVATAR_SIZE_EXPLAIN}</span></dt>
|
<dt><label for="avatar_gravatar_width">{L_GRAVATAR_AVATAR_SIZE}{L_COLON}</label><br /><span>{L_GRAVATAR_AVATAR_SIZE_EXPLAIN}</span></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<input type="text" name="avatar_gravatar_width" id="avatar_gravatar_width" size="3" value="{AVATAR_GRAVATAR_WIDTH}" class="inputbox autowidth" /> {L_PIXEL} ×
|
<input type="number" name="avatar_gravatar_width" id="avatar_gravatar_width" size="3" value="{AVATAR_GRAVATAR_WIDTH}" class="inputbox autowidth" /> {L_PIXEL} ×
|
||||||
<input type="text" name="avatar_gravatar_height" id="avatar_gravatar_height" size="3" value="{AVATAR_GRAVATAR_HEIGHT}" class="inputbox autowidth" /> {L_PIXEL}
|
<input type="number" name="avatar_gravatar_height" id="avatar_gravatar_height" size="3" value="{AVATAR_GRAVATAR_HEIGHT}" class="inputbox autowidth" /> {L_PIXEL}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="avatar_remote_url">{L_LINK_REMOTE_AVATAR}{L_COLON}</label><br /><span>{L_LINK_REMOTE_AVATAR_EXPLAIN}</span></dt>
|
<dt><label for="avatar_remote_url">{L_LINK_REMOTE_AVATAR}{L_COLON}</label><br /><span>{L_LINK_REMOTE_AVATAR_EXPLAIN}</span></dt>
|
||||||
<dd><input type="text" name="avatar_remote_url" id="avatar_remote_url" value="{AVATAR_REMOTE_URL}" class="inputbox" /></dd>
|
<dd><input type="url" name="avatar_remote_url" id="avatar_remote_url" value="{AVATAR_REMOTE_URL}" class="inputbox" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="avatar_remote_width">{L_LINK_REMOTE_SIZE}{L_COLON}</label><br /><span>{L_LINK_REMOTE_SIZE_EXPLAIN}</span></dt>
|
<dt><label for="avatar_remote_width">{L_LINK_REMOTE_SIZE}{L_COLON}</label><br /><span>{L_LINK_REMOTE_SIZE_EXPLAIN}</span></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<input type="text" name="avatar_remote_width" id="avatar_remote_width" size="3" value="{AVATAR_REMOTE_WIDTH}" class="inputbox autowidth" /> {L_PIXEL} ×
|
<input type="number" name="avatar_remote_width" id="avatar_remote_width" size="3" value="{AVATAR_REMOTE_WIDTH}" class="inputbox autowidth" /> {L_PIXEL} ×
|
||||||
<input type="text" name="avatar_remote_height" id="avatar_remote_height" size="3" value="{AVATAR_REMOTE_HEIGHT}" class="inputbox autowidth" /> {L_PIXEL}
|
<input type="number" name="avatar_remote_height" id="avatar_remote_height" size="3" value="{AVATAR_REMOTE_HEIGHT}" class="inputbox autowidth" /> {L_PIXEL}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
<!-- IF S_UPLOAD_AVATAR_URL -->
|
<!-- IF S_UPLOAD_AVATAR_URL -->
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="avatar_upload_url">{L_UPLOAD_AVATAR_URL}{L_COLON}</label><br /><span>{L_UPLOAD_AVATAR_URL_EXPLAIN}</span></dt>
|
<dt><label for="avatar_upload_url">{L_UPLOAD_AVATAR_URL}{L_COLON}</label><br /><span>{L_UPLOAD_AVATAR_URL_EXPLAIN}</span></dt>
|
||||||
<dd><input type="text" name="avatar_upload_url" id="avatar_upload_url" value="" class="inputbox" /></dd>
|
<dd><input type="url" name="avatar_upload_url" id="avatar_upload_url" value="" class="inputbox" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="max_reg_attempts">{L_REG_LIMIT}{L_COLON}</label><br /><span>{L_REG_LIMIT_EXPLAIN}</span></dt>
|
<dt><label for="max_reg_attempts">{L_REG_LIMIT}{L_COLON}</label><br /><span>{L_REG_LIMIT_EXPLAIN}</span></dt>
|
||||||
<dd><input id="max_reg_attempts" type="text" size="4" maxlength="4" name="max_reg_attempts" value="{REG_LIMIT}" /></dd>
|
<dd><input id="max_reg_attempts" type="number" size="4" maxlength="4" min="0" max="9999" name="max_reg_attempts" value="{REG_LIMIT}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="max_login_attempts">{L_MAX_LOGIN_ATTEMPTS}{L_COLON}</label><br /><span>{L_MAX_LOGIN_ATTEMPTS_EXPLAIN}</span></dt>
|
<dt><label for="max_login_attempts">{L_MAX_LOGIN_ATTEMPTS}{L_COLON}</label><br /><span>{L_MAX_LOGIN_ATTEMPTS_EXPLAIN}</span></dt>
|
||||||
<dd><input id="max_login_attempts" type="text" size="4" maxlength="4" name="max_login_attempts" value="{MAX_LOGIN_ATTEMPTS}" /></dd>
|
<dd><input id="max_login_attempts" type="number" size="4" maxlength="4" min="0" max="9999" name="max_login_attempts" value="{MAX_LOGIN_ATTEMPTS}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="enable_post_confirm">{L_VISUAL_CONFIRM_POST}{L_COLON}</label><br /><span>{L_VISUAL_CONFIRM_POST_EXPLAIN}</span></dt>
|
<dt><label for="enable_post_confirm">{L_VISUAL_CONFIRM_POST}{L_COLON}</label><br /><span>{L_VISUAL_CONFIRM_POST_EXPLAIN}</span></dt>
|
||||||
|
|
|
@ -152,7 +152,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="forum_desc">{L_FORUM_DESC}{L_COLON}</label><br /><span>{L_FORUM_DESC_EXPLAIN}</span></dt>
|
<dt><label for="forum_desc">{L_FORUM_DESC}{L_COLON}</label><br /><span>{L_FORUM_DESC_EXPLAIN}</span></dt>
|
||||||
<dd><textarea id="forum_desc" name="forum_desc" rows="5" cols="45">{FORUM_DESC}</textarea></dd>
|
<dd><textarea id="forum_desc" name="forum_desc" rows="5" cols="45" data-bbcode="true">{FORUM_DESC}</textarea></dd>
|
||||||
<dd><label><input type="checkbox" class="radio" name="desc_parse_bbcode"<!-- IF S_DESC_BBCODE_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_BBCODE}</label>
|
<dd><label><input type="checkbox" class="radio" name="desc_parse_bbcode"<!-- IF S_DESC_BBCODE_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_BBCODE}</label>
|
||||||
<label><input type="checkbox" class="radio" name="desc_parse_smilies"<!-- IF S_DESC_SMILIES_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_SMILIES}</label>
|
<label><input type="checkbox" class="radio" name="desc_parse_smilies"<!-- IF S_DESC_SMILIES_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_SMILIES}</label>
|
||||||
<label><input type="checkbox" class="radio" name="desc_parse_urls"<!-- IF S_DESC_URLS_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_URLS}</label></dd>
|
<label><input type="checkbox" class="radio" name="desc_parse_urls"<!-- IF S_DESC_URLS_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_URLS}</label></dd>
|
||||||
|
@ -239,7 +239,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="topics_per_page">{L_FORUM_TOPICS_PAGE}{L_COLON}</label><br /><span>{L_FORUM_TOPICS_PAGE_EXPLAIN}</span></dt>
|
<dt><label for="topics_per_page">{L_FORUM_TOPICS_PAGE}{L_COLON}</label><br /><span>{L_FORUM_TOPICS_PAGE_EXPLAIN}</span></dt>
|
||||||
<dd><input type="text" id="topics_per_page" name="topics_per_page" value="{TOPICS_PER_PAGE}" size="4" maxlength="4" /></dd>
|
<dd><input type="number" id="topics_per_page" name="topics_per_page" value="{TOPICS_PER_PAGE}" size="4" maxlength="4" min="0" max="9999" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- EVENT acp_forums_normal_settings_append -->
|
<!-- EVENT acp_forums_normal_settings_append -->
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
@ -253,15 +253,15 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="prune_freq">{L_AUTO_PRUNE_FREQ}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_FREQ_EXPLAIN}</span></dt>
|
<dt><label for="prune_freq">{L_AUTO_PRUNE_FREQ}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_FREQ_EXPLAIN}</span></dt>
|
||||||
<dd><input type="text" id="prune_freq" name="prune_freq" value="{PRUNE_FREQ}" maxlength="4" size="4" /> {L_DAYS}</dd>
|
<dd><input type="number" id="prune_freq" name="prune_freq" value="{PRUNE_FREQ}" maxlength="4" size="4" min="0" max="9999" /> {L_DAYS}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="prune_days">{L_AUTO_PRUNE_DAYS}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_DAYS_EXPLAIN}</span></dt>
|
<dt><label for="prune_days">{L_AUTO_PRUNE_DAYS}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_DAYS_EXPLAIN}</span></dt>
|
||||||
<dd><input type="text" id="prune_days" name="prune_days" value="{PRUNE_DAYS}" maxlength="4" size="4" /> {L_DAYS}</dd>
|
<dd><input type="number" id="prune_days" name="prune_days" value="{PRUNE_DAYS}" maxlength="4" size="4" min="0" max="9999" /> {L_DAYS}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="prune_viewed">{L_AUTO_PRUNE_VIEWED}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_VIEWED_EXPLAIN}</span></dt>
|
<dt><label for="prune_viewed">{L_AUTO_PRUNE_VIEWED}{L_COLON}</label><br /><span>{L_AUTO_PRUNE_VIEWED_EXPLAIN}</span></dt>
|
||||||
<dd><input type="text" id="prune_viewed" name="prune_viewed" value="{PRUNE_VIEWED}" maxlength="4" size="4" /> {L_DAYS}</dd>
|
<dd><input type="number" id="prune_viewed" name="prune_viewed" value="{PRUNE_VIEWED}" maxlength="4" size="4" min="0" max="9999" /> {L_DAYS}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="prune_old_polls">{L_PRUNE_OLD_POLLS}{L_COLON}</label><br /><span>{L_PRUNE_OLD_POLLS_EXPLAIN}</span></dt>
|
<dt><label for="prune_old_polls">{L_PRUNE_OLD_POLLS}{L_COLON}</label><br /><span>{L_PRUNE_OLD_POLLS_EXPLAIN}</span></dt>
|
||||||
|
@ -316,7 +316,7 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="forum_rules">{L_FORUM_RULES}{L_COLON}</label><br /><span>{L_FORUM_RULES_EXPLAIN}</span></dt>
|
<dt><label for="forum_rules">{L_FORUM_RULES}{L_COLON}</label><br /><span>{L_FORUM_RULES_EXPLAIN}</span></dt>
|
||||||
<dd><textarea id="forum_rules" name="forum_rules" rows="4" cols="70">{FORUM_RULES_PLAIN}</textarea></dd>
|
<dd><textarea id="forum_rules" name="forum_rules" rows="4" cols="70" data-bbcode="true">{FORUM_RULES_PLAIN}</textarea></dd>
|
||||||
<dd><label><input type="checkbox" class="radio" name="rules_parse_bbcode"<!-- IF S_BBCODE_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_BBCODE}</label>
|
<dd><label><input type="checkbox" class="radio" name="rules_parse_bbcode"<!-- IF S_BBCODE_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_BBCODE}</label>
|
||||||
<label><input type="checkbox" class="radio" name="rules_parse_smilies"<!-- IF S_SMILIES_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_SMILIES}</label>
|
<label><input type="checkbox" class="radio" name="rules_parse_smilies"<!-- IF S_SMILIES_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_SMILIES}</label>
|
||||||
<label><input type="checkbox" class="radio" name="rules_parse_urls"<!-- IF S_URLS_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_URLS}</label></dd>
|
<label><input type="checkbox" class="radio" name="rules_parse_urls"<!-- IF S_URLS_CHECKED --> checked="checked"<!-- ENDIF --> /> {L_PARSE_URLS}</label></dd>
|
||||||
|
|
|
@ -84,11 +84,11 @@
|
||||||
<legend>{L_GROUP_SETTINGS_SAVE}</legend>
|
<legend>{L_GROUP_SETTINGS_SAVE}</legend>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="group_message_limit">{L_GROUP_MESSAGE_LIMIT}{L_COLON}</label><br /><span>{L_GROUP_MESSAGE_LIMIT_EXPLAIN}</span></dt>
|
<dt><label for="group_message_limit">{L_GROUP_MESSAGE_LIMIT}{L_COLON}</label><br /><span>{L_GROUP_MESSAGE_LIMIT_EXPLAIN}</span></dt>
|
||||||
<dd><input name="group_message_limit" type="text" id="group_message_limit" maxlength="4" size="4" value="{GROUP_MESSAGE_LIMIT}" /></dd>
|
<dd><input name="group_message_limit" type="number" id="group_message_limit" maxlength="4" size="4" min="0" max="9999" value="{GROUP_MESSAGE_LIMIT}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="group_max_recipients">{L_GROUP_MAX_RECIPIENTS}{L_COLON}</label><br /><span>{L_GROUP_MAX_RECIPIENTS_EXPLAIN}</span></dt>
|
<dt><label for="group_max_recipients">{L_GROUP_MAX_RECIPIENTS}{L_COLON}</label><br /><span>{L_GROUP_MAX_RECIPIENTS_EXPLAIN}</span></dt>
|
||||||
<dd><input name="group_max_recipients" type="text" id="group_max_recipients" maxlength="10" size="4" value="{GROUP_MAX_RECIPIENTS}" /></dd>
|
<dd><input name="group_max_recipients" type="number" id="group_max_recipients" maxlength="10" size="4" value="{GROUP_MAX_RECIPIENTS}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="group_colour">{L_GROUP_COLOR}{L_COLON}</label><br /><span>{L_GROUP_COLOR_EXPLAIN}</span></dt>
|
<dt><label for="group_colour">{L_GROUP_COLOR}{L_COLON}</label><br /><span>{L_GROUP_COLOR_EXPLAIN}</span></dt>
|
||||||
|
|
|
@ -108,8 +108,8 @@
|
||||||
<td><input class="text post" type="text" name="code[{items.IMG}]" value="{items.CODE}" size="10" maxlength="50" /></td>
|
<td><input class="text post" type="text" name="code[{items.IMG}]" value="{items.CODE}" size="10" maxlength="50" /></td>
|
||||||
<td><input class="text post" type="text" name="emotion[{items.IMG}]" value="{items.EMOTION}" size="10" maxlength="50" /></td>
|
<td><input class="text post" type="text" name="emotion[{items.IMG}]" value="{items.EMOTION}" size="10" maxlength="50" /></td>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<td><input class="text post" type="text" size="3" name="width[{items.IMG}]" value="{items.WIDTH}" /></td>
|
<td><input class="text post" type="number" size="3" name="width[{items.IMG}]" value="{items.WIDTH}" /></td>
|
||||||
<td><input class="text post" type="text" size="3" name="height[{items.IMG}]" value="{items.HEIGHT}" /></td>
|
<td><input class="text post" type="number" size="3" name="height[{items.IMG}]" value="{items.HEIGHT}" /></td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" class="radio" name="display_on_posting[{items.IMG}]"{items.POSTING_CHECKED} onclick="toggle_select('{items.A_IMG}', this.checked, '{items.S_ROW_COUNT}');"/>
|
<input type="checkbox" class="radio" name="display_on_posting[{items.IMG}]"{items.POSTING_CHECKED} onclick="toggle_select('{items.A_IMG}', this.checked, '{items.S_ROW_COUNT}');"/>
|
||||||
<!-- IF items.S_ID -->
|
<!-- IF items.S_ID -->
|
||||||
|
@ -136,8 +136,8 @@
|
||||||
<td style="vertical-align: top;"><img src="{IMG_SRC}" id="add_image_src" alt="" title="" /></td>
|
<td style="vertical-align: top;"><img src="{IMG_SRC}" id="add_image_src" alt="" title="" /></td>
|
||||||
<td><input class="text post" type="text" name="add_code" id="add_code" value="{CODE}" size="10" maxlength="50" /></td>
|
<td><input class="text post" type="text" name="add_code" id="add_code" value="{CODE}" size="10" maxlength="50" /></td>
|
||||||
<td><input class="text post" type="text" name="add_emotion" id="add_emotion" value="{EMOTION}" size="10" maxlength="50" /></td>
|
<td><input class="text post" type="text" name="add_emotion" id="add_emotion" value="{EMOTION}" size="10" maxlength="50" /></td>
|
||||||
<td><input class="text post" type="text" size="3" name="add_width" id="add_width" value="{WIDTH}" /></td>
|
<td><input class="text post" type="number" size="3" name="add_width" id="add_width" value="{WIDTH}" /></td>
|
||||||
<td><input class="text post" type="text" size="3" name="add_height" id="add_height" value="{HEIGHT}" /></td>
|
<td><input class="text post" type="number" size="3" name="add_height" id="add_height" value="{HEIGHT}" /></td>
|
||||||
<td><input type="checkbox" class="radio" name="add_display_on_posting" checked="checked" onclick="toggle_select('add', this.checked, 'add_order');"/></td>
|
<td><input type="checkbox" class="radio" name="add_display_on_posting" checked="checked" onclick="toggle_select('add', this.checked, 'add_order');"/></td>
|
||||||
<td><select id="order_add_order" name="add_order">
|
<td><select id="order_add_order" name="add_order">
|
||||||
<optgroup id="order_disp_add_order" label="{L_DISPLAY_POSTING}">{S_ADD_ORDER_LIST_DISPLAY}</optgroup>
|
<optgroup id="order_disp_add_order" label="{L_DISPLAY_POSTING}">{S_ADD_ORDER_LIST_DISPLAY}</optgroup>
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<fieldset class="display-options">
|
<fieldset class="display-options">
|
||||||
{L_DISPLAY_LOG}{L_COLON} {S_LIMIT_DAYS} {L_SORT_BY}{L_COLON} {S_SORT_KEY} {S_SORT_DIR}<!-- IF .pagination --> Users per page{L_COLON} <input class="inputbox autowidth" type="text" name="users_per_page" id="users_per_page" size="3" value="{USERS_PER_PAGE}" /><!-- ENDIF -->
|
{L_DISPLAY_LOG}{L_COLON} {S_LIMIT_DAYS} {L_SORT_BY}{L_COLON} {S_SORT_KEY} {S_SORT_DIR}<!-- IF .pagination --> Users per page{L_COLON} <input class="inputbox autowidth" type="number" name="users_per_page" id="users_per_page" size="3" value="{USERS_PER_PAGE}" /><!-- ENDIF -->
|
||||||
<input class="button2" type="submit" value="{L_GO}" name="sort" />
|
<input class="button2" type="submit" value="{L_GO}" name="sort" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="jab_port">{L_JAB_PORT}{L_COLON}</label><br /><span>{L_JAB_PORT_EXPLAIN}</span></dt>
|
<dt><label for="jab_port">{L_JAB_PORT}{L_COLON}</label><br /><span>{L_JAB_PORT_EXPLAIN}</span></dt>
|
||||||
<dd><input type="text" id="jab_port" name="jab_port" value="{JAB_PORT}" maxlength="5" size="5" /></dd>
|
<dd><input type="number" id="jab_port" name="jab_port" value="{JAB_PORT}" maxlength="5" size="5" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="jab_username">{L_JAB_USERNAME}{L_COLON}</label><br /><span>{L_JAB_USERNAME_EXPLAIN}</span></dt>
|
<dt><label for="jab_username">{L_JAB_USERNAME}{L_COLON}</label><br /><span>{L_JAB_USERNAME_EXPLAIN}</span></dt>
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="jab_package_size">{L_JAB_PACKAGE_SIZE}{L_COLON}</label><br /><span>{L_JAB_PACKAGE_SIZE_EXPLAIN}</span></dt>
|
<dt><label for="jab_package_size">{L_JAB_PACKAGE_SIZE}{L_COLON}</label><br /><span>{L_JAB_PACKAGE_SIZE_EXPLAIN}</span></dt>
|
||||||
<dd><input type="text" id="jab_package_size" name="jab_package_size" value="{JAB_PACKAGE_SIZE}" maxlength="5" size="5" /></dd>
|
<dd><input type="number" id="jab_package_size" name="jab_package_size" value="{JAB_PACKAGE_SIZE}" maxlength="5" size="5" min="0" max="99999" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -73,11 +73,11 @@
|
||||||
<legend>{L_FORUM_PRUNE}</legend>
|
<legend>{L_FORUM_PRUNE}</legend>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="prune_days">{L_PRUNE_NOT_POSTED}{L_COLON}</label></dt>
|
<dt><label for="prune_days">{L_PRUNE_NOT_POSTED}{L_COLON}</label></dt>
|
||||||
<dd><input type="text" id="prune_days" name="prune_days" /></dd>
|
<dd><input type="number" id="prune_days" name="prune_days" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="prune_vieweddays">{L_PRUNE_NOT_VIEWED}{L_COLON}</label></dt>
|
<dt><label for="prune_vieweddays">{L_PRUNE_NOT_VIEWED}{L_COLON}</label></dt>
|
||||||
<dd><input type="text" id="prune_vieweddays" name="prune_vieweddays" /></dd>
|
<dd><input type="number" id="prune_vieweddays" name="prune_vieweddays" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="polls">{L_PRUNE_OLD_POLLS}{L_COLON}</label><br /><span>{L_PRUNE_OLD_POLLS_EXPLAIN}</span></dt>
|
<dt><label for="polls">{L_PRUNE_OLD_POLLS}{L_COLON}</label><br /><span>{L_PRUNE_OLD_POLLS_EXPLAIN}</span></dt>
|
||||||
|
|
|
@ -35,11 +35,11 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="count">{L_POSTS}{L_COLON}</label></dt>
|
<dt><label for="count">{L_POSTS}{L_COLON}</label></dt>
|
||||||
<dd><select name="count_select">{S_COUNT_OPTIONS}</select> <input type="text" id="count" name="count" /></dd>
|
<dd><select name="count_select">{S_COUNT_OPTIONS}</select> <input type="number" id="count" name="count" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="posts_on_queue">{L_POSTS_ON_QUEUE}{L_COLON}</label></dt>
|
<dt><label for="posts_on_queue">{L_POSTS_ON_QUEUE}{L_COLON}</label></dt>
|
||||||
<dd><select name="queue_select">{S_COUNT_OPTIONS}</select> <input type="text" id="posts_on_queue" name="posts_on_queue" /></select>
|
<dd><select name="queue_select">{S_COUNT_OPTIONS}</select> <input type="number" id="posts_on_queue" name="posts_on_queue" /></select>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- IF S_GROUP_LIST -->
|
<!-- IF S_GROUP_LIST -->
|
||||||
<dl>
|
<dl>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<!-- IF S_SPECIAL_RANK --><div id="posts" style="display: none;"><!-- ELSE --><div id="posts"><!-- ENDIF -->
|
<!-- IF S_SPECIAL_RANK --><div id="posts" style="display: none;"><!-- ELSE --><div id="posts"><!-- ENDIF -->
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="min_posts">{L_RANK_MINIMUM}{L_COLON}</label></dt>
|
<dt><label for="min_posts">{L_RANK_MINIMUM}{L_COLON}</label></dt>
|
||||||
<dd><input name="min_posts" type="text" id="min_posts" maxlength="10" value="{MIN_POSTS}" /></dd>
|
<dd><input name="min_posts" type="number" id="min_posts" maxlength="10" value="{MIN_POSTS}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="search_interval">{L_SEARCH_INTERVAL}{L_COLON}</label><br /><span>{L_SEARCH_INTERVAL_EXPLAIN}</span></dt>
|
<dt><label for="search_interval">{L_SEARCH_INTERVAL}{L_COLON}</label><br /><span>{L_SEARCH_INTERVAL_EXPLAIN}</span></dt>
|
||||||
<dd><input id="search_interval" type="text" size="4" maxlength="4" name="config[search_interval]" value="{SEARCH_INTERVAL}" /> {L_SECONDS}</dd>
|
<dd><input id="search_interval" type="number" size="4" maxlength="4" min="0" max="9999" name="config[search_interval]" value="{SEARCH_INTERVAL}" /> {L_SECONDS}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="search_anonymous_interval">{L_SEARCH_GUEST_INTERVAL}{L_COLON}</label><br /><span>{L_SEARCH_GUEST_INTERVAL_EXPLAIN}</span></dt>
|
<dt><label for="search_anonymous_interval">{L_SEARCH_GUEST_INTERVAL}{L_COLON}</label><br /><span>{L_SEARCH_GUEST_INTERVAL_EXPLAIN}</span></dt>
|
||||||
<dd><input id="search_anonymous_interval" type="text" size="4" maxlength="4" name="config[search_anonymous_interval]" value="{SEARCH_GUEST_INTERVAL}" /> {L_SECONDS}</dd>
|
<dd><input id="search_anonymous_interval" type="number" size="4" maxlength="4" min="0" max="9999" name="config[search_anonymous_interval]" value="{SEARCH_GUEST_INTERVAL}" /> {L_SECONDS}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="limit_search_load">{L_LIMIT_SEARCH_LOAD}{L_COLON}</label><br /><span>{L_LIMIT_SEARCH_LOAD_EXPLAIN}</span></dt>
|
<dt><label for="limit_search_load">{L_LIMIT_SEARCH_LOAD}{L_COLON}</label><br /><span>{L_LIMIT_SEARCH_LOAD_EXPLAIN}</span></dt>
|
||||||
|
@ -30,15 +30,15 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="min_search_author_chars">{L_MIN_SEARCH_AUTHOR_CHARS}{L_COLON}</label><br /><span>{L_MIN_SEARCH_AUTHOR_CHARS_EXPLAIN}</span></dt>
|
<dt><label for="min_search_author_chars">{L_MIN_SEARCH_AUTHOR_CHARS}{L_COLON}</label><br /><span>{L_MIN_SEARCH_AUTHOR_CHARS_EXPLAIN}</span></dt>
|
||||||
<dd><input id="min_search_author_chars" type="text" size="4" maxlength="4" name="config[min_search_author_chars]" value="{MIN_SEARCH_AUTHOR_CHARS}" /></dd>
|
<dd><input id="min_search_author_chars" type="number" size="4" maxlength="4" min="0" max="9999" name="config[min_search_author_chars]" value="{MIN_SEARCH_AUTHOR_CHARS}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="max_num_search_keywords">{L_MAX_NUM_SEARCH_KEYWORDS}{L_COLON}</label><br /><span>{L_MAX_NUM_SEARCH_KEYWORDS_EXPLAIN}</span></dt>
|
<dt><label for="max_num_search_keywords">{L_MAX_NUM_SEARCH_KEYWORDS}{L_COLON}</label><br /><span>{L_MAX_NUM_SEARCH_KEYWORDS_EXPLAIN}</span></dt>
|
||||||
<dd><input id="max_num_search_keywords" type="text" size="4" maxlength="4" name="config[max_num_search_keywords]" value="{MAX_NUM_SEARCH_KEYWORDS}" /></dd>
|
<dd><input id="max_num_search_keywords" type="number" size="4" maxlength="4" min="0" max="9999" name="config[max_num_search_keywords]" value="{MAX_NUM_SEARCH_KEYWORDS}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="search_store_results">{L_SEARCH_STORE_RESULTS}{L_COLON}</label><br /><span>{L_SEARCH_STORE_RESULTS_EXPLAIN}</span></dt>
|
<dt><label for="search_store_results">{L_SEARCH_STORE_RESULTS}{L_COLON}</label><br /><span>{L_SEARCH_STORE_RESULTS_EXPLAIN}</span></dt>
|
||||||
<dd><input id="search_store_results" type="text" size="4" maxlength="6" name="config[search_store_results]" value="{SEARCH_STORE_RESULTS}" /> {L_SECONDS}</dd>
|
<dd><input id="search_store_results" type="number" size="4" maxlength="6" min="0" max="999999" name="config[search_store_results]" value="{SEARCH_STORE_RESULTS}" /> {L_SECONDS}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="user_email">{L_EMAIL}{L_COLON}</label></dt>
|
<dt><label for="user_email">{L_EMAIL}{L_COLON}</label></dt>
|
||||||
<dd><input class="text medium" type="text" id="user_email" name="user_email" value="{USER_EMAIL}" autocomplete="off" /></dd>
|
<dd><input class="text medium" type="email" id="user_email" name="user_email" value="{USER_EMAIL}" autocomplete="off" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="new_password">{L_NEW_PASSWORD}{L_COLON}</label><br /><span>{L_CHANGE_PASSWORD_EXPLAIN}</span></dt>
|
<dt><label for="new_password">{L_NEW_PASSWORD}{L_COLON}</label><br /><span>{L_CHANGE_PASSWORD_EXPLAIN}</span></dt>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="msn">{L_UCP_MSNM}{L_COLON}</label></dt>
|
<dt><label for="msn">{L_UCP_MSNM}{L_COLON}</label></dt>
|
||||||
<dd><input type="text" id="msn" name="msn" value="{MSN}" /></dd>
|
<dd><input type="email" id="msn" name="msn" value="{MSN}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="yim">{L_UCP_YIM}{L_COLON}</label></dt>
|
<dt><label for="yim">{L_UCP_YIM}{L_COLON}</label></dt>
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="jabber">{L_UCP_JABBER}{L_COLON}</label></dt>
|
<dt><label for="jabber">{L_UCP_JABBER}{L_COLON}</label></dt>
|
||||||
<dd><input type="text" id="jabber" name="jabber" value="{JABBER}" /></dd>
|
<dd><input type="email" id="jabber" name="jabber" value="{JABBER}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="website">{L_WEBSITE}{L_COLON}</label></dt>
|
<dt><label for="website">{L_WEBSITE}{L_COLON}</label></dt>
|
||||||
<dd><input type="text" id="website" name="website" value="{WEBSITE}" /></dd>
|
<dd><input type="url" id="website" name="website" value="{WEBSITE}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="location">{L_LOCATION}{L_COLON}</label></dt>
|
<dt><label for="location">{L_LOCATION}{L_COLON}</label></dt>
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
// ]]>
|
// ]]>
|
||||||
</script>
|
</script>
|
||||||
</dt>
|
</dt>
|
||||||
<dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 90px;"><textarea name="signature" rows="10" cols="60" style="width: 95%;" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();">{SIGNATURE}</textarea></dd>
|
<dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 90px;"><textarea name="signature" rows="10" cols="60" style="width: 95%;" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();" data-bbcode="true">{SIGNATURE}</textarea></dd>
|
||||||
<dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 90px; margin-top: 5px;">
|
<dd style="margin-{S_CONTENT_FLOW_BEGIN}{L_COLON} 90px; margin-top: 5px;">
|
||||||
<!-- IF S_BBCODE_ALLOWED -->
|
<!-- IF S_BBCODE_ALLOWED -->
|
||||||
<label><input type="checkbox" class="radio" name="disable_bbcode"{S_BBCODE_CHECKED} /> {L_DISABLE_BBCODE}</label>
|
<label><input type="checkbox" class="radio" name="disable_bbcode"{S_BBCODE_CHECKED} /> {L_DISABLE_BBCODE}</label>
|
||||||
|
|
|
@ -148,6 +148,12 @@ $('[data-ajax]').each(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically resize textarea
|
||||||
|
*/
|
||||||
|
$(document).ready(function() {
|
||||||
|
phpbb.resizeTextArea($('textarea:not(.no-auto-resize)'), {minHeight: 75});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
})(jQuery); // Avoid conflicts with other libraries
|
})(jQuery); // Avoid conflicts with other libraries
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="captcha_gd_x_grid">{L_CAPTCHA_GD_X_GRID}{L_COLON}</label><br /><span>{L_CAPTCHA_GD_X_GRID_EXPLAIN}</span></dt>
|
<dt><label for="captcha_gd_x_grid">{L_CAPTCHA_GD_X_GRID}{L_COLON}</label><br /><span>{L_CAPTCHA_GD_X_GRID_EXPLAIN}</span></dt>
|
||||||
<dd><input id="captcha_gd_x_grid" name="captcha_gd_x_grid" value="{CAPTCHA_GD_X_GRID}" type="text" /></dd>
|
<dd><input id="captcha_gd_x_grid" name="captcha_gd_x_grid" value="{CAPTCHA_GD_X_GRID}" type="number" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="captcha_gd_y_grid">{L_CAPTCHA_GD_Y_GRID}{L_COLON}</label><br /><span>{L_CAPTCHA_GD_Y_GRID_EXPLAIN}</span></dt>
|
<dt><label for="captcha_gd_y_grid">{L_CAPTCHA_GD_Y_GRID}{L_COLON}</label><br /><span>{L_CAPTCHA_GD_Y_GRID_EXPLAIN}</span></dt>
|
||||||
<dd><input id="captcha_gd_y_grid" name="captcha_gd_y_grid" value="{CAPTCHA_GD_Y_GRID}" type="text" /></dd>
|
<dd><input id="captcha_gd_y_grid" name="captcha_gd_y_grid" value="{CAPTCHA_GD_Y_GRID}" type="number" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="captcha_gd_wave">{L_CAPTCHA_GD_WAVE}{L_COLON}</label><br /><span>{L_CAPTCHA_GD_WAVE_EXPLAIN}</span></dt>
|
<dt><label for="captcha_gd_wave">{L_CAPTCHA_GD_WAVE}{L_COLON}</label><br /><span>{L_CAPTCHA_GD_WAVE_EXPLAIN}</span></dt>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
{DEBUG_OUTPUT}
|
{DEBUG_OUTPUT}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}">
|
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}">
|
||||||
<div id="darken"> </div>
|
<div id="darken"> </div>
|
||||||
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -136,7 +136,7 @@ phpbb.confirm = function(msg, callback, fadedark) {
|
||||||
});
|
});
|
||||||
|
|
||||||
var clickHandler = function(e) {
|
var clickHandler = function(e) {
|
||||||
var res = this.className === 'button1';
|
var res = this.name === 'confirm';
|
||||||
var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
|
var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
|
||||||
fade.fadeOut(phpbb.alertTime, function() {
|
fade.fadeOut(phpbb.alertTime, function() {
|
||||||
div.hide();
|
div.hide();
|
||||||
|
@ -164,11 +164,11 @@ phpbb.confirm = function(msg, callback, fadedark) {
|
||||||
|
|
||||||
$(document).bind('keydown', function(e) {
|
$(document).bind('keydown', function(e) {
|
||||||
if (e.keyCode === keymap.ENTER) {
|
if (e.keyCode === keymap.ENTER) {
|
||||||
$('input[type="button"].button1').trigger('click');
|
$('input[name="confirm"]').trigger('click');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
} else if (e.keyCode === keymap.ESC) {
|
} else if (e.keyCode === keymap.ESC) {
|
||||||
$('input[type="button"].button2').trigger('click');
|
$('input[name="cancel"]').trigger('click');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
|
@ -252,9 +252,24 @@ phpbb.ajaxify = function(options) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function errorHandler() {
|
/**
|
||||||
|
* Handler for AJAX errors
|
||||||
|
*/
|
||||||
|
function errorHandler(jqXHR, textStatus, errorThrown) {
|
||||||
|
if (console && console.log) {
|
||||||
|
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown);
|
||||||
|
}
|
||||||
phpbb.clearLoadingTimeout();
|
phpbb.clearLoadingTimeout();
|
||||||
phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text'));
|
var errorText = false;
|
||||||
|
if (typeof errorThrown === 'string' && errorThrown.length > 0) {
|
||||||
|
errorText = errorThrown;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
errorText = dark.attr('data-ajax-error-text-' + textStatus);
|
||||||
|
if (typeof errorText !== 'string' || !errorText.length)
|
||||||
|
errorText = dark.attr('data-ajax-error-text');
|
||||||
|
}
|
||||||
|
phpbb.alert(dark.attr('data-ajax-error-title'), errorText);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -568,4 +583,259 @@ phpbb.addAjaxCallback('toggle_link', function() {
|
||||||
el.parent().attr('class', toggleClass);
|
el.parent().attr('class', toggleClass);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically resize textarea
|
||||||
|
*
|
||||||
|
* This function automatically resizes textarea elements when user
|
||||||
|
* types text.
|
||||||
|
*
|
||||||
|
* @param {jQuery} items jQuery object(s) to resize
|
||||||
|
* @param {object} options Optional parameter that adjusts default
|
||||||
|
* configuration. See configuration variable
|
||||||
|
*
|
||||||
|
* Optional parameters:
|
||||||
|
* minWindowHeight {number} Minimum browser window height when textareas are resized. Default = 500
|
||||||
|
* minHeight {number} Minimum height of textarea. Default = 200
|
||||||
|
* maxHeight {number} Maximum height of textarea. Default = 500
|
||||||
|
* heightDiff {number} Minimum difference between window and textarea height. Default = 200
|
||||||
|
* resizeCallback {function} Function to call after resizing textarea
|
||||||
|
* resetCallback {function} Function to call when resize has been canceled
|
||||||
|
|
||||||
|
* Callback function format: function(item) {}
|
||||||
|
* this points to DOM object
|
||||||
|
* item is a jQuery object, same as this
|
||||||
|
*/
|
||||||
|
phpbb.resizeTextArea = function(items, options) {
|
||||||
|
// Configuration
|
||||||
|
var configuration = {
|
||||||
|
minWindowHeight: 500,
|
||||||
|
minHeight: 200,
|
||||||
|
maxHeight: 500,
|
||||||
|
heightDiff: 200,
|
||||||
|
resizeCallback: function(item) { },
|
||||||
|
resetCallback: function(item) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (arguments.length > 1)
|
||||||
|
{
|
||||||
|
configuration = $.extend(configuration, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetAutoResize(item)
|
||||||
|
{
|
||||||
|
var $item = $(item);
|
||||||
|
if ($item.hasClass('auto-resized'))
|
||||||
|
{
|
||||||
|
$(item).css({height: '', resize: ''}).removeClass('auto-resized');
|
||||||
|
configuration.resetCallback.call(item, $item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function autoResize(item)
|
||||||
|
{
|
||||||
|
function setHeight(height)
|
||||||
|
{
|
||||||
|
$item.css({height: height + 'px', resize: 'none'}).addClass('auto-resized');
|
||||||
|
configuration.resizeCallback.call(item, $item);
|
||||||
|
}
|
||||||
|
|
||||||
|
var windowHeight = $(window).height();
|
||||||
|
|
||||||
|
if (windowHeight < configuration.minWindowHeight)
|
||||||
|
{
|
||||||
|
resetAutoResize(item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var maxHeight = Math.min(Math.max(windowHeight - configuration.heightDiff, configuration.minHeight), configuration.maxHeight),
|
||||||
|
$item = $(item),
|
||||||
|
height = parseInt($item.height()),
|
||||||
|
scrollHeight = (item.scrollHeight) ? item.scrollHeight : 0;
|
||||||
|
|
||||||
|
if (height > maxHeight)
|
||||||
|
{
|
||||||
|
setHeight(maxHeight);
|
||||||
|
}
|
||||||
|
else if (scrollHeight > (height + 5))
|
||||||
|
{
|
||||||
|
setHeight(Math.min(maxHeight, scrollHeight));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
items.bind('focus change keyup', function() {
|
||||||
|
$(this).each(function() {
|
||||||
|
autoResize(this);
|
||||||
|
});
|
||||||
|
}).change();
|
||||||
|
|
||||||
|
$(window).resize(function() {
|
||||||
|
items.each(function() {
|
||||||
|
if ($(this).hasClass('auto-resized'))
|
||||||
|
{
|
||||||
|
autoResize(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if cursor in textarea is currently inside a bbcode tag
|
||||||
|
*
|
||||||
|
* @param {object} textarea Textarea DOM object
|
||||||
|
* @param {Array} startTags List of start tags to look for
|
||||||
|
* For example, Array('[code]', '[code=')
|
||||||
|
* @param {Array} endTags List of end tags to look for
|
||||||
|
* For example, Array('[/code]')
|
||||||
|
*
|
||||||
|
* @return {boolean} True if cursor is in bbcode tag
|
||||||
|
*/
|
||||||
|
phpbb.inBBCodeTag = function(textarea, startTags, endTags) {
|
||||||
|
var start = textarea.selectionStart,
|
||||||
|
lastEnd = -1,
|
||||||
|
lastStart = -1,
|
||||||
|
i, index, value;
|
||||||
|
|
||||||
|
if (typeof start !== 'number') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = textarea.value.toLowerCase();
|
||||||
|
|
||||||
|
for (i = 0; i < startTags.length; i++) {
|
||||||
|
var tagLength = startTags[i].length;
|
||||||
|
if (start >= tagLength) {
|
||||||
|
index = value.lastIndexOf(startTags[i], start - tagLength);
|
||||||
|
lastStart = Math.max(lastStart, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lastStart == -1) return false;
|
||||||
|
|
||||||
|
if (start > 0) {
|
||||||
|
for (i = 0; i < endTags.length; i++) {
|
||||||
|
index = value.lastIndexOf(endTags[i], start - 1);
|
||||||
|
lastEnd = Math.max(lastEnd, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (lastEnd < lastStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust textarea to manage code bbcode
|
||||||
|
*
|
||||||
|
* This function allows to use tab characters when typing code
|
||||||
|
* and keeps indentation of previous line of code when adding new
|
||||||
|
* line while typing code.
|
||||||
|
*
|
||||||
|
* Editor's functionality is changed only when cursor is between
|
||||||
|
* [code] and [/code] bbcode tags.
|
||||||
|
*
|
||||||
|
* @param {object} textarea Textarea DOM object to apply editor to
|
||||||
|
*/
|
||||||
|
phpbb.applyCodeEditor = function(textarea) {
|
||||||
|
// list of allowed start and end bbcode code tags, in lower case
|
||||||
|
var startTags = ['[code]', '[code='],
|
||||||
|
startTagsEnd = ']',
|
||||||
|
endTags = ['[/code]'];
|
||||||
|
|
||||||
|
if (!textarea || typeof textarea.selectionStart !== 'number') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($(textarea).data('code-editor') === true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
function inTag() {
|
||||||
|
return phpbb.inBBCodeTag(textarea, startTags, endTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get line of text before cursor
|
||||||
|
*
|
||||||
|
* @param {boolean} stripCodeStart If true, only part of line
|
||||||
|
* after [code] tag will be returned.
|
||||||
|
*
|
||||||
|
* @return {string} Line of text
|
||||||
|
*/
|
||||||
|
function getLastLine(stripCodeStart) {
|
||||||
|
var start = textarea.selectionStart,
|
||||||
|
value = textarea.value,
|
||||||
|
index = value.lastIndexOf("\n", start - 1);
|
||||||
|
|
||||||
|
value = value.substring(index + 1, start);
|
||||||
|
|
||||||
|
if (stripCodeStart) {
|
||||||
|
for (var i = 0; i < startTags.length; i++) {
|
||||||
|
index = value.lastIndexOf(startTags[i]);
|
||||||
|
if (index >= 0) {
|
||||||
|
var tagLength = startTags[i].length;
|
||||||
|
|
||||||
|
value = value.substring(index + tagLength);
|
||||||
|
if (startTags[i].lastIndexOf(startTagsEnd) != tagLength) {
|
||||||
|
index = value.indexOf(startTagsEnd);
|
||||||
|
|
||||||
|
if (index >= 0) {
|
||||||
|
value = value.substr(index + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append text at cursor position
|
||||||
|
*
|
||||||
|
* @param {string} Text Text to append
|
||||||
|
*/
|
||||||
|
function appendText(text) {
|
||||||
|
var start = textarea.selectionStart,
|
||||||
|
end = textarea.selectionEnd,
|
||||||
|
value = textarea.value;
|
||||||
|
|
||||||
|
textarea.value = value.substr(0, start) + text + value.substr(end);
|
||||||
|
textarea.selectionStart = textarea.selectionEnd = start + text.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(textarea).data('code-editor', true).on('keydown', function(event) {
|
||||||
|
var key = event.keyCode || event.which;
|
||||||
|
|
||||||
|
// intercept tabs
|
||||||
|
if (key == 9) {
|
||||||
|
if (inTag()) {
|
||||||
|
appendText("\t");
|
||||||
|
event.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// intercept new line characters
|
||||||
|
if (key == 13) {
|
||||||
|
if (inTag()) {
|
||||||
|
var lastLine = getLastLine(true),
|
||||||
|
code = '' + /^\s*/g.exec(lastLine);
|
||||||
|
|
||||||
|
if (code.length > 0) {
|
||||||
|
appendText("\n" + code);
|
||||||
|
event.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply code editor to all textarea elements with data-bbcode attribute
|
||||||
|
*/
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('textarea[data-bbcode]').each(function() {
|
||||||
|
phpbb.applyCodeEditor(this);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
})(jQuery); // Avoid conflicts with other libraries
|
})(jQuery); // Avoid conflicts with other libraries
|
||||||
|
|
20
phpBB/assets/javascript/jquery.js
vendored
20
phpBB/assets/javascript/jquery.js
vendored
File diff suppressed because one or more lines are too long
|
@ -9,6 +9,8 @@
|
||||||
"symfony/yaml": "2.1.*"
|
"symfony/yaml": "2.1.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fabpot/goutte": "v0.1.0"
|
"fabpot/goutte": "v0.1.0",
|
||||||
|
"phpunit/dbunit": "1.2.*",
|
||||||
|
"phpunit/phpunit": "3.7.*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
755
phpBB/composer.lock
generated
755
phpBB/composer.lock
generated
File diff suppressed because it is too large
Load diff
98
phpBB/config/feed.yml
Normal file
98
phpBB/config/feed.yml
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
services:
|
||||||
|
feed.helper:
|
||||||
|
class: phpbb_feed_helper
|
||||||
|
arguments:
|
||||||
|
- @config
|
||||||
|
- @user
|
||||||
|
- %core.root_path%
|
||||||
|
|
||||||
|
feed.factory:
|
||||||
|
class: phpbb_feed_factory
|
||||||
|
arguments:
|
||||||
|
- @service_container
|
||||||
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
|
|
||||||
|
feed.forum:
|
||||||
|
class: phpbb_feed_forum
|
||||||
|
scope: prototype
|
||||||
|
arguments:
|
||||||
|
- @feed.helper
|
||||||
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
|
- @cache.driver
|
||||||
|
- @user
|
||||||
|
- @auth
|
||||||
|
- %core.php_ext%
|
||||||
|
|
||||||
|
feed.forums:
|
||||||
|
class: phpbb_feed_forums
|
||||||
|
scope: prototype
|
||||||
|
arguments:
|
||||||
|
- @feed.helper
|
||||||
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
|
- @cache.driver
|
||||||
|
- @user
|
||||||
|
- @auth
|
||||||
|
- %core.php_ext%
|
||||||
|
|
||||||
|
feed.news:
|
||||||
|
class: phpbb_feed_news
|
||||||
|
scope: prototype
|
||||||
|
arguments:
|
||||||
|
- @feed.helper
|
||||||
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
|
- @cache.driver
|
||||||
|
- @user
|
||||||
|
- @auth
|
||||||
|
- %core.php_ext%
|
||||||
|
|
||||||
|
feed.overall:
|
||||||
|
class: phpbb_feed_overall
|
||||||
|
scope: prototype
|
||||||
|
arguments:
|
||||||
|
- @feed.helper
|
||||||
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
|
- @cache.driver
|
||||||
|
- @user
|
||||||
|
- @auth
|
||||||
|
- %core.php_ext%
|
||||||
|
|
||||||
|
feed.topic:
|
||||||
|
class: phpbb_feed_topic
|
||||||
|
scope: prototype
|
||||||
|
arguments:
|
||||||
|
- @feed.helper
|
||||||
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
|
- @cache.driver
|
||||||
|
- @user
|
||||||
|
- @auth
|
||||||
|
- %core.php_ext%
|
||||||
|
|
||||||
|
feed.topics:
|
||||||
|
class: phpbb_feed_topics
|
||||||
|
scope: prototype
|
||||||
|
arguments:
|
||||||
|
- @feed.helper
|
||||||
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
|
- @cache.driver
|
||||||
|
- @user
|
||||||
|
- @auth
|
||||||
|
- %core.php_ext%
|
||||||
|
|
||||||
|
feed.topics_active:
|
||||||
|
class: phpbb_feed_topics_active
|
||||||
|
scope: prototype
|
||||||
|
arguments:
|
||||||
|
- @feed.helper
|
||||||
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
|
- @cache.driver
|
||||||
|
- @user
|
||||||
|
- @auth
|
||||||
|
- %core.php_ext%
|
|
@ -4,6 +4,7 @@ imports:
|
||||||
- { resource: notifications.yml }
|
- { resource: notifications.yml }
|
||||||
- { resource: migrator.yml }
|
- { resource: migrator.yml }
|
||||||
- { resource: avatars.yml }
|
- { resource: avatars.yml }
|
||||||
|
- { resource: feed.yml }
|
||||||
|
|
||||||
services:
|
services:
|
||||||
auth:
|
auth:
|
||||||
|
@ -130,7 +131,6 @@ services:
|
||||||
- @service_container
|
- @service_container
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @config
|
- @config
|
||||||
- @migrator
|
|
||||||
- @filesystem
|
- @filesystem
|
||||||
- %tables.ext%
|
- %tables.ext%
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
|
@ -218,6 +218,7 @@ services:
|
||||||
- @service_container
|
- @service_container
|
||||||
- @user_loader
|
- @user_loader
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
|
- @cache
|
||||||
- @user
|
- @user
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
|
@ -1317,16 +1317,20 @@ function get_schema_struct()
|
||||||
|
|
||||||
$schema_data['phpbb_notification_types'] = array(
|
$schema_data['phpbb_notification_types'] = array(
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => array(
|
||||||
'notification_type' => array('VCHAR:255', ''),
|
'notification_type_id' => array('USINT', NULL, 'auto_increment'),
|
||||||
|
'notification_type_name' => array('VCHAR:255', ''),
|
||||||
'notification_type_enabled' => array('BOOL', 1),
|
'notification_type_enabled' => array('BOOL', 1),
|
||||||
),
|
),
|
||||||
'PRIMARY_KEY' => array('notification_type', 'notification_type_enabled'),
|
'PRIMARY_KEY' => array('notification_type_id'),
|
||||||
|
'KEYS' => array(
|
||||||
|
'type' => array('UNIQUE', array('notification_type_name')),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$schema_data['phpbb_notifications'] = array(
|
$schema_data['phpbb_notifications'] = array(
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => array(
|
||||||
'notification_id' => array('UINT', NULL, 'auto_increment'),
|
'notification_id' => array('UINT:10', NULL, 'auto_increment'),
|
||||||
'item_type' => array('VCHAR:255', ''),
|
'notification_type_id' => array('USINT', 0),
|
||||||
'item_id' => array('UINT', 0),
|
'item_id' => array('UINT', 0),
|
||||||
'item_parent_id' => array('UINT', 0),
|
'item_parent_id' => array('UINT', 0),
|
||||||
'user_id' => array('UINT', 0),
|
'user_id' => array('UINT', 0),
|
||||||
|
@ -1336,7 +1340,7 @@ function get_schema_struct()
|
||||||
),
|
),
|
||||||
'PRIMARY_KEY' => 'notification_id',
|
'PRIMARY_KEY' => 'notification_id',
|
||||||
'KEYS' => array(
|
'KEYS' => array(
|
||||||
'item_ident' => array('INDEX', array('item_type', 'item_id')),
|
'item_ident' => array('INDEX', array('notification_type_id', 'item_id')),
|
||||||
'user' => array('INDEX', array('user_id', 'notification_read')),
|
'user' => array('INDEX', array('user_id', 'notification_read')),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,10 +24,9 @@ phpBB Lead Developer: naderman (Nils Adermann)
|
||||||
|
|
||||||
phpBB Developers: bantu (Andreas Fischer)
|
phpBB Developers: bantu (Andreas Fischer)
|
||||||
EXreaction (Nathan Guse)
|
EXreaction (Nathan Guse)
|
||||||
igorw (Igor Wiedler)
|
dhruv.goel92 (Dhruv Goel)
|
||||||
imkingdavid (David King)
|
imkingdavid (David King)
|
||||||
nickvergessen (Joas Schilling)
|
nickvergessen (Joas Schilling)
|
||||||
Oleg (Oleg Pudeyev)
|
|
||||||
|
|
||||||
Contributions by: leviatan21 (Gabriel Vazquez)
|
Contributions by: leviatan21 (Gabriel Vazquez)
|
||||||
Raimon (Raimon Meuldijk)
|
Raimon (Raimon Meuldijk)
|
||||||
|
@ -53,6 +52,8 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010]
|
||||||
dhn (Dominik Dröscher) [05/2007 - 01/2011]
|
dhn (Dominik Dröscher) [05/2007 - 01/2011]
|
||||||
GrahamJE (Graham Eames) [09/2005 - 11/2006]
|
GrahamJE (Graham Eames) [09/2005 - 11/2006]
|
||||||
kellanved (Henry Sudhof) [04/2007 - 03/2011]
|
kellanved (Henry Sudhof) [04/2007 - 03/2011]
|
||||||
|
igorw (Igor Wiedler) [08/2010 - 02/2013]
|
||||||
|
Oleg (Oleg Pudeyev) [01/2011 - 05/2013]
|
||||||
rxu (Ruslan Uzdenov) [04/2010 - 12/2012]
|
rxu (Ruslan Uzdenov) [04/2010 - 12/2012]
|
||||||
TerraFrost (Jim Wigginton) [04/2009 - 01/2011]
|
TerraFrost (Jim Wigginton) [04/2009 - 01/2011]
|
||||||
ToonArmy (Chris Smith) [06/2008 - 11/2011]
|
ToonArmy (Chris Smith) [06/2008 - 11/2011]
|
||||||
|
|
|
@ -1060,6 +1060,8 @@ $action_ary = request_var('action', array('' => 0));
|
||||||
<h4>Login checks/redirection: </h4>
|
<h4>Login checks/redirection: </h4>
|
||||||
<p>To show a forum login box use <code>login_forum_box($forum_data)</code>, else use the <code>login_box()</code> function.</p>
|
<p>To show a forum login box use <code>login_forum_box($forum_data)</code>, else use the <code>login_box()</code> function.</p>
|
||||||
|
|
||||||
|
<p><code>$forum_data</code> should contain at least the <code>forum_id</code> and <code>forum_password</code> fields. If the field <code>forum_name</code> is available, then it is displayed on the forum login page.</p>
|
||||||
|
|
||||||
<p>The <code>login_box()</code> function can have a redirect as the first parameter. As a thumb of rule, specify an empty string if you want to redirect to the users current location, else do not add the <code>$SID</code> to the redirect string (for example within the ucp/login we redirect to the board index because else the user would be redirected to the login screen).</p>
|
<p>The <code>login_box()</code> function can have a redirect as the first parameter. As a thumb of rule, specify an empty string if you want to redirect to the users current location, else do not add the <code>$SID</code> to the redirect string (for example within the ucp/login we redirect to the board index because else the user would be redirected to the login screen).</p>
|
||||||
|
|
||||||
<h4>Sensitive Operations: </h4>
|
<h4>Sensitive Operations: </h4>
|
||||||
|
@ -2490,7 +2492,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<a name="disclaimer"></a><h2>8. Copyright and disclaimer</h2>
|
<a name="disclaimer"></a><h2>7. Copyright and disclaimer</h2>
|
||||||
|
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<div class="inner"><span class="corners-top"><span></span></span>
|
<div class="inner"><span class="corners-top"><span></span></span>
|
||||||
|
|
1180
phpBB/feed.php
1180
phpBB/feed.php
File diff suppressed because it is too large
Load diff
|
@ -117,8 +117,8 @@ class acp_attachments
|
||||||
'attachment_quota' => array('lang' => 'ATTACH_QUOTA', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true),
|
'attachment_quota' => array('lang' => 'ATTACH_QUOTA', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true),
|
||||||
'max_filesize' => array('lang' => 'ATTACH_MAX_FILESIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true),
|
'max_filesize' => array('lang' => 'ATTACH_MAX_FILESIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true),
|
||||||
'max_filesize_pm' => array('lang' => 'ATTACH_MAX_PM_FILESIZE','validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true),
|
'max_filesize_pm' => array('lang' => 'ATTACH_MAX_PM_FILESIZE','validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true),
|
||||||
'max_attachments' => array('lang' => 'MAX_ATTACHMENTS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => false),
|
'max_attachments' => array('lang' => 'MAX_ATTACHMENTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => false),
|
||||||
'max_attachments_pm' => array('lang' => 'MAX_ATTACHMENTS_PM', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => false),
|
'max_attachments_pm' => array('lang' => 'MAX_ATTACHMENTS_PM', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => false),
|
||||||
'secure_downloads' => array('lang' => 'SECURE_DOWNLOADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'secure_downloads' => array('lang' => 'SECURE_DOWNLOADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'secure_allow_deny' => array('lang' => 'SECURE_ALLOW_DENY', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_allow_deny', 'explain' => true),
|
'secure_allow_deny' => array('lang' => 'SECURE_ALLOW_DENY', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_allow_deny', 'explain' => true),
|
||||||
'secure_allow_empty_referer' => array('lang' => 'SECURE_EMPTY_REFERRER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'secure_allow_empty_referer' => array('lang' => 'SECURE_EMPTY_REFERRER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
@ -128,11 +128,11 @@ class acp_attachments
|
||||||
'legend2' => $l_legend_cat_images,
|
'legend2' => $l_legend_cat_images,
|
||||||
'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'img_create_thumbnail' => array('lang' => 'CREATE_THUMBNAIL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'img_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', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
'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', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
|
'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
|
||||||
'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'string', 'type' => 'text:20:200', 'explain' => true, 'append' => ' <span>[ <a href="' . $this->u_action . '&action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'),
|
'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'string', 'type' => 'text:20:200', 'explain' => true, 'append' => ' <span>[ <a href="' . $this->u_action . '&action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'),
|
||||||
'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
'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', 'type' => 'dimension:3:4', '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']),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1670,7 +1670,8 @@ class acp_attachments
|
||||||
$size_var = $filesize['si_identifier'];
|
$size_var = $filesize['si_identifier'];
|
||||||
$value = $filesize['value'];
|
$value = $filesize['value'];
|
||||||
|
|
||||||
return '<input type="text" id="' . $key . '" size="8" maxlength="15" name="config[' . $key . ']" value="' . $value . '" /> <select name="' . $key . '">' . size_select_options($size_var) . '</select>';
|
// size="8" and maxlength="15" attributes as a fallback for browsers that do not support type="number" yet.
|
||||||
|
return '<input type="number" id="' . $key . '" size="8" maxlength="15" min="0" name="config[' . $key . ']" value="' . $value . '" /> <select name="' . $key . '">' . size_select_options($size_var) . '</select>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,7 +53,7 @@ class acp_board
|
||||||
'legend1' => 'ACP_BOARD_SETTINGS',
|
'legend1' => 'ACP_BOARD_SETTINGS',
|
||||||
'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
|
'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
|
||||||
'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
|
'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
|
||||||
'site_home_url' => array('lang' => 'SITE_HOME_URL', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
|
'site_home_url' => array('lang' => 'SITE_HOME_URL', 'validate' => 'string', 'type' => 'url:40:255', 'explain' => true),
|
||||||
'site_home_text' => array('lang' => 'SITE_HOME_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
|
'site_home_text' => array('lang' => 'SITE_HOME_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
|
||||||
'board_index_text' => array('lang' => 'BOARD_INDEX_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
|
'board_index_text' => array('lang' => 'BOARD_INDEX_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
|
||||||
'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true),
|
'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true),
|
||||||
|
@ -65,7 +65,7 @@ class acp_board
|
||||||
'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
|
||||||
'legend2' => 'WARNINGS',
|
'legend2' => 'WARNINGS',
|
||||||
'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
|
'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
|
||||||
|
|
||||||
'legend3' => 'ACP_SUBMIT_CHANGES',
|
'legend3' => 'ACP_SUBMIT_CHANGES',
|
||||||
)
|
)
|
||||||
|
@ -136,8 +136,8 @@ class acp_board
|
||||||
'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
|
'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
|
||||||
|
|
||||||
'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
||||||
'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -154,11 +154,11 @@ class acp_board
|
||||||
'vars' => array(
|
'vars' => array(
|
||||||
'legend1' => 'GENERAL_SETTINGS',
|
'legend1' => 'GENERAL_SETTINGS',
|
||||||
'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
|
'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
|
'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true),
|
'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true),
|
||||||
'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
|
'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
|
||||||
'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true),
|
'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true),
|
||||||
|
|
||||||
'legend2' => 'GENERAL_OPTIONS',
|
'legend2' => 'GENERAL_OPTIONS',
|
||||||
'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
||||||
|
@ -195,24 +195,24 @@ class acp_board
|
||||||
|
|
||||||
'legend2' => 'POSTING',
|
'legend2' => 'POSTING',
|
||||||
'bump_type' => false,
|
'bump_type' => false,
|
||||||
'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
|
'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
|
||||||
'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
|
'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
|
||||||
'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0:9999999999', 'type' => 'number:0:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
||||||
'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true),
|
'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true),
|
||||||
'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false),
|
'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false),
|
||||||
'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false),
|
'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false),
|
||||||
'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false),
|
'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false),
|
||||||
'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true),
|
'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false),
|
'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'number:2:127', 'explain' => false),
|
||||||
'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true),
|
'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0:999999', 'type' => 'number:0:999999', 'explain' => true),
|
||||||
'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1', 'type' => 'text:4:6', 'explain' => true),
|
'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1:999999', 'type' => 'number:1:999999', 'explain' => true),
|
||||||
'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
|
'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
|
'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'),
|
'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'),
|
||||||
'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
|
'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
||||||
'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
||||||
|
|
||||||
'legend3' => 'ACP_SUBMIT_CHANGES',
|
'legend3' => 'ACP_SUBMIT_CHANGES',
|
||||||
)
|
)
|
||||||
|
@ -232,12 +232,12 @@ class acp_board
|
||||||
'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
|
||||||
'legend2' => 'GENERAL_SETTINGS',
|
'legend2' => 'GENERAL_SETTINGS',
|
||||||
'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
|
'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
|
'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'),
|
'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'),
|
||||||
'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
|
'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
||||||
'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
|
||||||
|
|
||||||
'legend3' => 'ACP_SUBMIT_CHANGES',
|
'legend3' => 'ACP_SUBMIT_CHANGES',
|
||||||
)
|
)
|
||||||
|
@ -253,20 +253,20 @@ class acp_board
|
||||||
'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
|
'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
|
||||||
|
|
||||||
'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true),
|
'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true),
|
||||||
'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']),
|
'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']),
|
||||||
'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true),
|
'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true),
|
||||||
'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true),
|
'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true),
|
||||||
'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true),
|
'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true),
|
||||||
'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
|
'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
|
||||||
'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
|
'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
|
||||||
|
|
||||||
'legend2' => 'GENERAL_OPTIONS',
|
'legend2' => 'GENERAL_OPTIONS',
|
||||||
'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
||||||
'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true),
|
'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true),
|
||||||
'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
|
'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
|
|
||||||
'legend3' => 'COPPA',
|
'legend3' => 'COPPA',
|
||||||
'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
@ -288,13 +288,13 @@ class acp_board
|
||||||
'feed_http_auth' => array('lang' => 'ACP_FEED_HTTP_AUTH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
'feed_http_auth' => array('lang' => 'ACP_FEED_HTTP_AUTH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
||||||
|
|
||||||
'legend2' => 'ACP_FEED_POST_BASED',
|
'legend2' => 'ACP_FEED_POST_BASED',
|
||||||
'feed_limit_post' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true),
|
'feed_limit_post' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true),
|
||||||
'feed_overall' => array('lang' => 'ACP_FEED_OVERALL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
'feed_overall' => array('lang' => 'ACP_FEED_OVERALL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
||||||
'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
||||||
'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
||||||
|
|
||||||
'legend3' => 'ACP_FEED_TOPIC_BASED',
|
'legend3' => 'ACP_FEED_TOPIC_BASED',
|
||||||
'feed_limit_topic' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true),
|
'feed_limit_topic' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true),
|
||||||
'feed_topics_new' => array('lang' => 'ACP_FEED_TOPICS_NEW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
'feed_topics_new' => array('lang' => 'ACP_FEED_TOPICS_NEW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
||||||
'feed_topics_active' => array('lang' => 'ACP_FEED_TOPICS_ACTIVE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
'feed_topics_active' => array('lang' => 'ACP_FEED_TOPICS_ACTIVE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
|
||||||
'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true),
|
'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true),
|
||||||
|
@ -324,10 +324,10 @@ class acp_board
|
||||||
'title' => 'ACP_LOAD_SETTINGS',
|
'title' => 'ACP_LOAD_SETTINGS',
|
||||||
'vars' => array(
|
'vars' => array(
|
||||||
'legend1' => 'GENERAL_SETTINGS',
|
'legend1' => 'GENERAL_SETTINGS',
|
||||||
'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true),
|
'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60', 'type' => 'text:5:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60:9999999999', 'type' => 'number:60:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
||||||
'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
|
'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
|
||||||
'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0', 'type' => 'text:4:3', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
|
'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
|
||||||
|
|
||||||
'legend2' => 'GENERAL_OPTIONS',
|
'legend2' => 'GENERAL_OPTIONS',
|
||||||
'load_notifications' => array('lang' => 'LOAD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'load_notifications' => array('lang' => 'LOAD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
@ -384,7 +384,7 @@ class acp_board
|
||||||
'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true),
|
'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true),
|
||||||
'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
|
'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
|
||||||
'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true),
|
'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true),
|
||||||
'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true),
|
'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true),
|
||||||
|
|
||||||
'legend4' => 'ACP_SUBMIT_CHANGES',
|
'legend4' => 'ACP_SUBMIT_CHANGES',
|
||||||
|
@ -398,7 +398,8 @@ class acp_board
|
||||||
'vars' => array(
|
'vars' => array(
|
||||||
'legend1' => 'ACP_SECURITY_SETTINGS',
|
'legend1' => 'ACP_SECURITY_SETTINGS',
|
||||||
'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
|
'allow_password_reset' => array('lang' => 'ALLOW_PASSWORD_RESET', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
|
||||||
'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true),
|
'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true),
|
||||||
'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
@ -408,13 +409,13 @@ class acp_board
|
||||||
'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
|
'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
|
||||||
'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true),
|
'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true),
|
||||||
'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
|
'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
|
||||||
'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
|
'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
|
||||||
'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true),
|
'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true),
|
||||||
'ip_login_limit_max' => array('lang' => 'IP_LOGIN_LIMIT_MAX', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true),
|
'ip_login_limit_max' => array('lang' => 'IP_LOGIN_LIMIT_MAX', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true),
|
||||||
'ip_login_limit_time' => array('lang' => 'IP_LOGIN_LIMIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
'ip_login_limit_time' => array('lang' => 'IP_LOGIN_LIMIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
||||||
'ip_login_limit_use_forwarded' => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'ip_login_limit_use_forwarded' => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1:99999', 'type' => 'number:-1:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
|
||||||
'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -429,16 +430,16 @@ class acp_board
|
||||||
'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
||||||
'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
|
||||||
'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true),
|
'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true),
|
||||||
'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true),
|
'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'number:0:99999', 'explain' => true),
|
||||||
'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'text:25:100', 'explain' => true),
|
'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true),
|
||||||
'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'text:25:100', 'explain' => true),
|
'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true),
|
||||||
'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true),
|
'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true),
|
||||||
'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
|
||||||
'legend2' => 'SMTP_SETTINGS',
|
'legend2' => 'SMTP_SETTINGS',
|
||||||
'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => false),
|
'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => false),
|
||||||
'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0', 'type' => 'text:4:5', 'explain' => true),
|
'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true),
|
||||||
'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true),
|
'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true),
|
||||||
'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true),
|
'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true),
|
||||||
'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true),
|
'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true),
|
||||||
|
@ -823,7 +824,7 @@ class acp_board
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $this->new_config['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
|
return '<input id="' . $key . '" type="number" size="3" maxlength="3" min="1" max="999" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="number" size="3" maxlength="3" min="8" max="180" name="config[max_name_chars]" value="' . $this->new_config['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -851,7 +852,7 @@ class acp_board
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $this->new_config['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
|
return '<input id="' . $key . '" type="number" size="3" maxlength="3" min="1" max="999" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="number" size="3" maxlength="3" min="8" max="255" name="config[max_pass_chars]" value="' . $this->new_config['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,6 +44,10 @@ class acp_extensions
|
||||||
$action = $request->variable('action', 'list');
|
$action = $request->variable('action', 'list');
|
||||||
$ext_name = $request->variable('ext_name', '');
|
$ext_name = $request->variable('ext_name', '');
|
||||||
|
|
||||||
|
// What is a safe limit of execution time? Half the max execution time should be safe.
|
||||||
|
$safe_time_limit = (ini_get('max_execution_time') / 2);
|
||||||
|
$start_time = time();
|
||||||
|
|
||||||
// Cancel action
|
// Cancel action
|
||||||
if ($request->is_set_post('cancel'))
|
if ($request->is_set_post('cancel'))
|
||||||
{
|
{
|
||||||
|
@ -54,7 +58,7 @@ class acp_extensions
|
||||||
// If they've specified an extension, let's load the metadata manager and validate it.
|
// If they've specified an extension, let's load the metadata manager and validate it.
|
||||||
if ($ext_name)
|
if ($ext_name)
|
||||||
{
|
{
|
||||||
$md_manager = new phpbb_extension_metadata_manager($ext_name, $db, $phpbb_extension_manager, $phpbb_root_path, $phpEx, $template, $config);
|
$md_manager = new phpbb_extension_metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $phpbb_root_path);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -105,13 +109,17 @@ class acp_extensions
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ($phpbb_extension_manager->enable_step($ext_name))
|
while ($phpbb_extension_manager->enable_step($ext_name))
|
||||||
|
{
|
||||||
|
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
||||||
|
if ((time() - $start_time) >= $safe_time_limit)
|
||||||
{
|
{
|
||||||
$template->assign_var('S_NEXT_STEP', true);
|
$template->assign_var('S_NEXT_STEP', true);
|
||||||
|
|
||||||
meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name));
|
meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (phpbb_db_migration_exception $e)
|
catch (phpbb_db_migration_exception $e)
|
||||||
{
|
{
|
||||||
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
||||||
|
@ -139,12 +147,16 @@ class acp_extensions
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disable':
|
case 'disable':
|
||||||
if ($phpbb_extension_manager->disable_step($ext_name))
|
while ($phpbb_extension_manager->disable_step($ext_name))
|
||||||
|
{
|
||||||
|
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
||||||
|
if ((time() - $start_time) >= $safe_time_limit)
|
||||||
{
|
{
|
||||||
$template->assign_var('S_NEXT_STEP', true);
|
$template->assign_var('S_NEXT_STEP', true);
|
||||||
|
|
||||||
meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name));
|
meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->tpl_name = 'acp_ext_disable';
|
$this->tpl_name = 'acp_ext_disable';
|
||||||
|
|
||||||
|
@ -165,13 +177,17 @@ class acp_extensions
|
||||||
case 'purge':
|
case 'purge':
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ($phpbb_extension_manager->purge_step($ext_name))
|
while ($phpbb_extension_manager->purge_step($ext_name))
|
||||||
|
{
|
||||||
|
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
||||||
|
if ((time() - $start_time) >= $safe_time_limit)
|
||||||
{
|
{
|
||||||
$template->assign_var('S_NEXT_STEP', true);
|
$template->assign_var('S_NEXT_STEP', true);
|
||||||
|
|
||||||
meta_refresh(0, $this->u_action . '&action=purge&ext_name=' . urlencode($ext_name));
|
meta_refresh(0, $this->u_action . '&action=purge&ext_name=' . urlencode($ext_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (phpbb_db_migration_exception $e)
|
catch (phpbb_db_migration_exception $e)
|
||||||
{
|
{
|
||||||
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
||||||
|
|
|
@ -87,6 +87,11 @@ class acp_groups
|
||||||
case 'approve':
|
case 'approve':
|
||||||
case 'demote':
|
case 'demote':
|
||||||
case 'promote':
|
case 'promote':
|
||||||
|
if (!check_form_key($form_key))
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$group_id)
|
if (!$group_id)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
|
@ -259,6 +264,11 @@ class acp_groups
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'addusers':
|
case 'addusers':
|
||||||
|
if (!check_form_key($form_key))
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$group_id)
|
if (!$group_id)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
|
@ -381,15 +391,26 @@ class acp_groups
|
||||||
$submit_ary['avatar_width'] = 0;
|
$submit_ary['avatar_width'] = 0;
|
||||||
$submit_ary['avatar_height'] = 0;
|
$submit_ary['avatar_height'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Merge any avatar errors into the primary error array
|
||||||
|
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the length of "Maximum number of allowed recipients per private message" setting.
|
/*
|
||||||
// We use 16777215 as a maximum because it matches MySQL unsigned mediumint maximum value
|
* Validate the length of "Maximum number of allowed recipients per
|
||||||
// which is the lowest amongst DBMSes supported by phpBB3
|
* private message" setting. We use 16777215 as a maximum because it matches
|
||||||
if ($max_recipients_error = validate_data($submit_ary, array('max_recipients' => array('num', false, 0, 16777215))))
|
* MySQL unsigned mediumint maximum value which is the lowest amongst DBMSes
|
||||||
|
* supported by phpBB3. Also validate the submitted colour value.
|
||||||
|
*/
|
||||||
|
$validation_checks = array(
|
||||||
|
'max_recipients' => array('num', false, 0, 16777215),
|
||||||
|
'colour' => array('hex_colour', true),
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($validation_error = validate_data($submit_ary, $validation_checks))
|
||||||
{
|
{
|
||||||
// Replace "error" string with its real, localised form
|
// Replace "error" string with its real, localised form
|
||||||
$error = array_merge($error, array_map(array(&$user, 'lang'), $max_recipients_error));
|
$error = array_merge($error, array_map(array(&$user, 'lang'), $validation_error));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
|
@ -570,8 +591,11 @@ class acp_groups
|
||||||
|
|
||||||
$avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true);
|
$avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true);
|
||||||
|
|
||||||
|
if (isset($phpbb_avatar_manager) && !$update)
|
||||||
|
{
|
||||||
// Merge any avatar errors into the primary error array
|
// Merge any avatar errors into the primary error array
|
||||||
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
|
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
|
||||||
|
}
|
||||||
|
|
||||||
$back_link = request_var('back_link', '');
|
$back_link = request_var('back_link', '');
|
||||||
|
|
||||||
|
@ -906,10 +930,12 @@ class acp_groups
|
||||||
case 'set_config_teampage':
|
case 'set_config_teampage':
|
||||||
$config->set('teampage_forums', $request->variable('teampage_forums', 0));
|
$config->set('teampage_forums', $request->variable('teampage_forums', 0));
|
||||||
$config->set('teampage_memberships', $request->variable('teampage_memberships', 0));
|
$config->set('teampage_memberships', $request->variable('teampage_memberships', 0));
|
||||||
|
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'set_config_legend':
|
case 'set_config_legend':
|
||||||
$config->set('legend_sort_groupname', $request->variable('legend_sort_groupname', 0));
|
$config->set('legend_sort_groupname', $request->variable('legend_sort_groupname', 0));
|
||||||
|
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,17 +544,13 @@ class acp_modules
|
||||||
*/
|
*/
|
||||||
function get_module_infos($module = '', $module_class = false, $use_all_available = false)
|
function get_module_infos($module = '', $module_class = false, $use_all_available = false)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_extension_manager, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
$module_class = ($module_class === false) ? $this->module_class : $module_class;
|
$module_class = ($module_class === false) ? $this->module_class : $module_class;
|
||||||
|
|
||||||
$directory = $phpbb_root_path . 'includes/' . $module_class . '/info/';
|
$directory = $phpbb_root_path . 'includes/' . $module_class . '/info/';
|
||||||
$fileinfo = array();
|
$fileinfo = array();
|
||||||
|
|
||||||
if (!$module)
|
|
||||||
{
|
|
||||||
global $phpbb_extension_manager;
|
|
||||||
|
|
||||||
$finder = $phpbb_extension_manager->get_finder();
|
$finder = $phpbb_extension_manager->get_finder();
|
||||||
|
|
||||||
$modules = $finder
|
$modules = $finder
|
||||||
|
@ -564,9 +560,16 @@ class acp_modules
|
||||||
->core_prefix($module_class . '_')
|
->core_prefix($module_class . '_')
|
||||||
->get_classes(true, $use_all_available);
|
->get_classes(true, $use_all_available);
|
||||||
|
|
||||||
foreach ($modules as $module)
|
foreach ($modules as $cur_module)
|
||||||
{
|
{
|
||||||
$info_class = preg_replace('/_module$/', '_info', $module);
|
// Skip entries we do not need if we know the module we are
|
||||||
|
// looking for
|
||||||
|
if ($module && strpos($cur_module, $module) === false)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$info_class = preg_replace('/_module$/', '_info', $cur_module);
|
||||||
|
|
||||||
// If the class does not exist it might be following the old
|
// If the class does not exist it might be following the old
|
||||||
// format. phpbb_acp_info_acp_foo needs to be turned into
|
// format. phpbb_acp_info_acp_foo needs to be turned into
|
||||||
|
@ -574,10 +577,11 @@ class acp_modules
|
||||||
// manually because it does not support auto loading
|
// manually because it does not support auto loading
|
||||||
if (!class_exists($info_class))
|
if (!class_exists($info_class))
|
||||||
{
|
{
|
||||||
$info_class = str_replace("phpbb_{$module_class}_info_", '', $module) . '_info';
|
$info_class_file = str_replace("phpbb_{$module_class}_info_", '', $cur_module);
|
||||||
if (file_exists($directory . $info_class . '.' . $phpEx))
|
$info_class = $info_class_file . '_info';
|
||||||
|
if (!class_exists($info_class) && file_exists($directory . $info_class_file . '.' . $phpEx))
|
||||||
{
|
{
|
||||||
include($directory . $info_class . '.' . $phpEx);
|
include($directory . $info_class_file . '.' . $phpEx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,38 +590,13 @@ class acp_modules
|
||||||
$info = new $info_class();
|
$info = new $info_class();
|
||||||
$module_info = $info->module();
|
$module_info = $info->module();
|
||||||
|
|
||||||
$main_class = (isset($module_info['filename'])) ? $module_info['filename'] : $module;
|
$main_class = (isset($module_info['filename'])) ? $module_info['filename'] : $cur_module;
|
||||||
|
|
||||||
$fileinfo[$main_class] = $module_info;
|
$fileinfo[$main_class] = $module_info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ksort($fileinfo);
|
ksort($fileinfo);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$info_class = preg_replace('/_module$/', '_info', $module);
|
|
||||||
|
|
||||||
if (!class_exists($info_class))
|
|
||||||
{
|
|
||||||
$info_class = $module . '_info';
|
|
||||||
if (!class_exists($info_class) && file_exists($directory . $module . '.' . $phpEx))
|
|
||||||
{
|
|
||||||
include($directory . $module . '.' . $phpEx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get module title tag
|
|
||||||
if (class_exists($info_class))
|
|
||||||
{
|
|
||||||
$info = new $info_class();
|
|
||||||
$module_info = $info->module();
|
|
||||||
|
|
||||||
$main_class = (isset($module_info['filename'])) ? $module_info['filename'] : $module;
|
|
||||||
|
|
||||||
$fileinfo[$main_class] = $module_info;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $fileinfo;
|
return $fileinfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class acp_update
|
||||||
|
|
||||||
$info = obtain_latest_version_info(request_var('versioncheck_force', false));
|
$info = obtain_latest_version_info(request_var('versioncheck_force', false));
|
||||||
|
|
||||||
if ($info === false)
|
if (empty($info))
|
||||||
{
|
{
|
||||||
trigger_error('VERSIONCHECK_FAIL', E_USER_WARNING);
|
trigger_error('VERSIONCHECK_FAIL', E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,7 +330,7 @@ function acp_ldap(&$new)
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="ldap_email">' . $user->lang['LDAP_EMAIL'] . $user->lang['COLON'] . '</label><br /><span>' . $user->lang['LDAP_EMAIL_EXPLAIN'] . '</span></dt>
|
<dt><label for="ldap_email">' . $user->lang['LDAP_EMAIL'] . $user->lang['COLON'] . '</label><br /><span>' . $user->lang['LDAP_EMAIL_EXPLAIN'] . '</span></dt>
|
||||||
<dd><input type="text" id="ldap_email" size="40" name="config[ldap_email]" value="' . $new['ldap_email'] . '" /></dd>
|
<dd><input type="email" id="ldap_email" size="40" name="config[ldap_email]" value="' . $new['ldap_email'] . '" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="ldap_user">' . $user->lang['LDAP_USER'] . $user->lang['COLON'] . '</label><br /><span>' . $user->lang['LDAP_USER_EXPLAIN'] . '</span></dt>
|
<dt><label for="ldap_user">' . $user->lang['LDAP_USER'] . $user->lang['COLON'] . '</label><br /><span>' . $user->lang['LDAP_USER_EXPLAIN'] . '</span></dt>
|
||||||
|
|
|
@ -126,7 +126,7 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
|
'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
|
||||||
'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true),
|
'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
28
phpBB/includes/db/migration/data/310/forgot_password.php
Normal file
28
phpBB/includes/db/migration/data/310/forgot_password.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package migration
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class phpbb_db_migration_data_310_forgot_password extends phpbb_db_migration
|
||||||
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return isset($this->config['allow_password_reset']);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function depends_on()
|
||||||
|
{
|
||||||
|
return array('phpbb_db_migration_data_30x_3_0_11');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_data()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('config.add', array('allow_password_reset', 1)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
31
phpBB/includes/db/migration/data/310/jquery_update.php
Normal file
31
phpBB/includes/db/migration/data/310/jquery_update.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package migration
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class phpbb_db_migration_data_310_jquery_update extends phpbb_db_migration
|
||||||
|
{
|
||||||
|
public function effectively_installed()
|
||||||
|
{
|
||||||
|
return $this->config['load_jquery_url'] !== '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js';
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function depends_on()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'phpbb_db_migration_data_310_dev',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_data()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package migration
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class phpbb_db_migration_data_310_notifications_schema_fix extends phpbb_db_migration
|
||||||
|
{
|
||||||
|
static public function depends_on()
|
||||||
|
{
|
||||||
|
return array('phpbb_db_migration_data_310_notifications');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update_schema()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'drop_tables' => array(
|
||||||
|
$this->table_prefix . 'notification_types',
|
||||||
|
$this->table_prefix . 'notifications',
|
||||||
|
),
|
||||||
|
'add_tables' => array(
|
||||||
|
$this->table_prefix . 'notification_types' => array(
|
||||||
|
'COLUMNS' => array(
|
||||||
|
'notification_type_id' => array('USINT', NULL, 'auto_increment'),
|
||||||
|
'notification_type_name' => array('VCHAR:255', ''),
|
||||||
|
'notification_type_enabled' => array('BOOL', 1),
|
||||||
|
),
|
||||||
|
'PRIMARY_KEY' => array('notification_type_id'),
|
||||||
|
'KEYS' => array(
|
||||||
|
'type' => array('UNIQUE', array('notification_type_name')),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$this->table_prefix . 'notifications' => array(
|
||||||
|
'COLUMNS' => array(
|
||||||
|
'notification_id' => array('UINT:10', NULL, 'auto_increment'),
|
||||||
|
'notification_type_id' => array('USINT', 0),
|
||||||
|
'item_id' => array('UINT', 0),
|
||||||
|
'item_parent_id' => array('UINT', 0),
|
||||||
|
'user_id' => array('UINT', 0),
|
||||||
|
'notification_read' => array('BOOL', 0),
|
||||||
|
'notification_time' => array('TIMESTAMP', 1),
|
||||||
|
'notification_data' => array('TEXT_UNI', ''),
|
||||||
|
),
|
||||||
|
'PRIMARY_KEY' => 'notification_id',
|
||||||
|
'KEYS' => array(
|
||||||
|
'item_ident' => array('INDEX', array('notification_type_id', 'item_id')),
|
||||||
|
'user' => array('INDEX', array('user_id', 'notification_read')),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function revert_schema()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'drop_tables' => array(
|
||||||
|
$this->table_prefix . 'notification_types',
|
||||||
|
$this->table_prefix . 'notifications',
|
||||||
|
),
|
||||||
|
'add_tables' => array(
|
||||||
|
$this->table_prefix . 'notification_types' => array(
|
||||||
|
'COLUMNS' => array(
|
||||||
|
'notification_type' => array('VCHAR:255', ''),
|
||||||
|
'notification_type_enabled' => array('BOOL', 1),
|
||||||
|
),
|
||||||
|
'PRIMARY_KEY' => array('notification_type', 'notification_type_enabled'),
|
||||||
|
),
|
||||||
|
$this->table_prefix . 'notifications' => array(
|
||||||
|
'COLUMNS' => array(
|
||||||
|
'notification_id' => array('UINT', NULL, 'auto_increment'),
|
||||||
|
'item_type' => array('VCHAR:255', ''),
|
||||||
|
'item_id' => array('UINT', 0),
|
||||||
|
'item_parent_id' => array('UINT', 0),
|
||||||
|
'user_id' => array('UINT', 0),
|
||||||
|
'notification_read' => array('BOOL', 0),
|
||||||
|
'notification_time' => array('TIMESTAMP', 1),
|
||||||
|
'notification_data' => array('TEXT_UNI', ''),
|
||||||
|
),
|
||||||
|
'PRIMARY_KEY' => 'notification_id',
|
||||||
|
'KEYS' => array(
|
||||||
|
'item_ident' => array('INDEX', array('item_type', 'item_id')),
|
||||||
|
'user' => array('INDEX', array('user_id', 'notification_read')),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -209,9 +209,6 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
|
||||||
}
|
}
|
||||||
|
|
||||||
// The "manual" way
|
// The "manual" way
|
||||||
$module_log_name = ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']);
|
|
||||||
add_log('admin', 'LOG_MODULE_ADD', $module_log_name);
|
|
||||||
|
|
||||||
if (!is_numeric($parent))
|
if (!is_numeric($parent))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT module_id
|
$sql = 'SELECT module_id
|
||||||
|
@ -267,6 +264,8 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Success
|
// Success
|
||||||
|
$module_log_name = ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']);
|
||||||
|
add_log('admin', 'LOG_MODULE_ADD', $module_log_name);
|
||||||
|
|
||||||
// Move the module if requested above/below an existing one
|
// Move the module if requested above/below an existing one
|
||||||
if (isset($data['before']) && $data['before'])
|
if (isset($data['before']) && $data['before'])
|
||||||
|
|
|
@ -27,25 +27,51 @@ class phpbb_extension_base implements phpbb_extension_interface
|
||||||
/** @var ContainerInterface */
|
/** @var ContainerInterface */
|
||||||
protected $container;
|
protected $container;
|
||||||
|
|
||||||
|
/** @var phpbb_extension_finder */
|
||||||
|
protected $finder;
|
||||||
|
|
||||||
|
/** @var phpbb_db_migrator */
|
||||||
|
protected $migrator;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $extension_name;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $extension_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param ContainerInterface $container Container object
|
* @param ContainerInterface $container Container object
|
||||||
|
* @param phpbb_extension_finder $extension_finder
|
||||||
|
* @param string $extension_name Name of this extension (from ext.manager)
|
||||||
|
* @param string $extension_path Relative path to this extension
|
||||||
*/
|
*/
|
||||||
public function __construct(ContainerInterface $container)
|
public function __construct(ContainerInterface $container, phpbb_extension_finder $extension_finder, phpbb_db_migrator $migrator, $extension_name, $extension_path)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
|
$this->extension_finder = $extension_finder;
|
||||||
|
$this->migrator = $migrator;
|
||||||
|
|
||||||
|
$this->extension_name = $extension_name;
|
||||||
|
$this->extension_path = $extension_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single enable step that does nothing
|
* Single enable step that installs any included migrations
|
||||||
*
|
*
|
||||||
* @param mixed $old_state State returned by previous call of this method
|
* @param mixed $old_state State returned by previous call of this method
|
||||||
* @return false Indicates no further steps are required
|
* @return false Indicates no further steps are required
|
||||||
*/
|
*/
|
||||||
public function enable_step($old_state)
|
public function enable_step($old_state)
|
||||||
{
|
{
|
||||||
return false;
|
$migrations = $this->get_migration_file_list();
|
||||||
|
|
||||||
|
$this->migrator->set_migrations($migrations);
|
||||||
|
|
||||||
|
$this->migrator->update();
|
||||||
|
|
||||||
|
return !$this->migrator->finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,13 +86,50 @@ class phpbb_extension_base implements phpbb_extension_interface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single purge step that does nothing
|
* Single purge step that reverts any included and installed migrations
|
||||||
*
|
*
|
||||||
* @param mixed $old_state State returned by previous call of this method
|
* @param mixed $old_state State returned by previous call of this method
|
||||||
* @return false Indicates no further steps are required
|
* @return false Indicates no further steps are required
|
||||||
*/
|
*/
|
||||||
public function purge_step($old_state)
|
public function purge_step($old_state)
|
||||||
{
|
{
|
||||||
|
$migrations = $this->get_migration_file_list();
|
||||||
|
|
||||||
|
$this->migrator->set_migrations($migrations);
|
||||||
|
|
||||||
|
foreach ($migrations as $migration)
|
||||||
|
{
|
||||||
|
while ($this->migrator->migration_state($migration) !== false)
|
||||||
|
{
|
||||||
|
$this->migrator->revert($migration);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of migration files from this extension
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function get_migration_file_list()
|
||||||
|
{
|
||||||
|
static $migrations = false;
|
||||||
|
|
||||||
|
if ($migrations !== false)
|
||||||
|
{
|
||||||
|
return $migrations;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only have the finder search in this extension path directory
|
||||||
|
$migrations = $this->extension_finder
|
||||||
|
->extension_directory('/migrations')
|
||||||
|
->find_from_extension($this->extension_name, $this->extension_path);
|
||||||
|
$migrations = $this->extension_finder->get_classes_from_files($migrations);
|
||||||
|
|
||||||
|
return $migrations;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,6 +378,34 @@ class phpbb_extension_finder
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds all file system entries matching the configured options for one
|
||||||
|
* specific extension
|
||||||
|
*
|
||||||
|
* @param string $extension_name Name of the extension
|
||||||
|
* @param string $extension_path Relative path to the extension root directory
|
||||||
|
* @param bool $cache Whether the result should be cached
|
||||||
|
* @param bool $is_dir Directories will be returned when true, only files
|
||||||
|
* otherwise
|
||||||
|
* @return array An array of paths to found items
|
||||||
|
*/
|
||||||
|
public function find_from_extension($extension_name, $extension_path, $cache = true, $is_dir = false)
|
||||||
|
{
|
||||||
|
$extensions = array(
|
||||||
|
$extension_name => $extension_path,
|
||||||
|
);
|
||||||
|
|
||||||
|
$files = array();
|
||||||
|
$file_list = $this->find_from_paths($extensions, $cache, $is_dir);
|
||||||
|
|
||||||
|
foreach ($file_list as $file)
|
||||||
|
{
|
||||||
|
$files[$file['named_path']] = $file['ext_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all file system entries matching the configured options from
|
* Finds all file system entries matching the configured options from
|
||||||
* an array of paths
|
* an array of paths
|
||||||
|
|
|
@ -29,7 +29,6 @@ class phpbb_extension_manager
|
||||||
|
|
||||||
protected $db;
|
protected $db;
|
||||||
protected $config;
|
protected $config;
|
||||||
protected $migrator;
|
|
||||||
protected $cache;
|
protected $cache;
|
||||||
protected $php_ext;
|
protected $php_ext;
|
||||||
protected $extensions;
|
protected $extensions;
|
||||||
|
@ -43,7 +42,6 @@ class phpbb_extension_manager
|
||||||
* @param ContainerInterface $container A container
|
* @param ContainerInterface $container A container
|
||||||
* @param phpbb_db_driver $db A database connection
|
* @param phpbb_db_driver $db A database connection
|
||||||
* @param phpbb_config $config phpbb_config
|
* @param phpbb_config $config phpbb_config
|
||||||
* @param phpbb_db_migrator $migrator
|
|
||||||
* @param phpbb_filesystem $filesystem
|
* @param phpbb_filesystem $filesystem
|
||||||
* @param string $extension_table The name of the table holding extensions
|
* @param string $extension_table The name of the table holding extensions
|
||||||
* @param string $phpbb_root_path Path to the phpbb includes directory.
|
* @param string $phpbb_root_path Path to the phpbb includes directory.
|
||||||
|
@ -51,13 +49,12 @@ class phpbb_extension_manager
|
||||||
* @param phpbb_cache_driver_interface $cache A cache instance or null
|
* @param phpbb_cache_driver_interface $cache A cache instance or null
|
||||||
* @param string $cache_name The name of the cache variable, defaults to _ext
|
* @param string $cache_name The name of the cache variable, defaults to _ext
|
||||||
*/
|
*/
|
||||||
public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_db_migrator $migrator, phpbb_filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
|
public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->migrator = $migrator;
|
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
$this->filesystem = $filesystem;
|
$this->filesystem = $filesystem;
|
||||||
$this->php_ext = $php_ext;
|
$this->php_ext = $php_ext;
|
||||||
|
@ -136,13 +133,15 @@ class phpbb_extension_manager
|
||||||
{
|
{
|
||||||
$extension_class_name = 'phpbb_ext_' . str_replace('/', '_', $name) . '_ext';
|
$extension_class_name = 'phpbb_ext_' . str_replace('/', '_', $name) . '_ext';
|
||||||
|
|
||||||
|
$migrator = $this->container->get('migrator');
|
||||||
|
|
||||||
if (class_exists($extension_class_name))
|
if (class_exists($extension_class_name))
|
||||||
{
|
{
|
||||||
return new $extension_class_name($this->container);
|
return new $extension_class_name($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new phpbb_extension_base($this->container);
|
return new phpbb_extension_base($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +154,7 @@ class phpbb_extension_manager
|
||||||
*/
|
*/
|
||||||
public function create_extension_metadata_manager($name, phpbb_template $template)
|
public function create_extension_metadata_manager($name, phpbb_template $template)
|
||||||
{
|
{
|
||||||
return new phpbb_extension_metadata_manager($name, $this->db, $this, $this->phpbb_root_path, $this->php_ext, $template, $this->config);
|
return new phpbb_extension_metadata_manager($name, $this->config, $this, $template, $this->phpbb_root_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,12 +177,6 @@ class phpbb_extension_manager
|
||||||
|
|
||||||
$old_state = (isset($this->extensions[$name]['ext_state'])) ? unserialize($this->extensions[$name]['ext_state']) : false;
|
$old_state = (isset($this->extensions[$name]['ext_state'])) ? unserialize($this->extensions[$name]['ext_state']) : false;
|
||||||
|
|
||||||
// Returns false if not completed
|
|
||||||
if (!$this->handle_migrations($name, 'enable'))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$extension = $this->get_extension($name);
|
$extension = $this->get_extension($name);
|
||||||
$state = $extension->enable_step($old_state);
|
$state = $extension->enable_step($old_state);
|
||||||
|
|
||||||
|
@ -199,12 +192,21 @@ class phpbb_extension_manager
|
||||||
$this->extensions[$name]['ext_path'] = $this->get_extension_path($extension_data['ext_name']);
|
$this->extensions[$name]['ext_path'] = $this->get_extension_path($extension_data['ext_name']);
|
||||||
ksort($this->extensions);
|
ksort($this->extensions);
|
||||||
|
|
||||||
|
$sql = 'SELECT COUNT(ext_name) as row_count
|
||||||
|
FROM ' . $this->extension_table . "
|
||||||
|
WHERE ext_name = '" . $this->db->sql_escape($name) . "'";
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$count = $this->db->sql_fetchfield('row_count');
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($count)
|
||||||
|
{
|
||||||
$sql = 'UPDATE ' . $this->extension_table . '
|
$sql = 'UPDATE ' . $this->extension_table . '
|
||||||
SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . "
|
SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . "
|
||||||
WHERE ext_name = '" . $this->db->sql_escape($name) . "'";
|
WHERE ext_name = '" . $this->db->sql_escape($name) . "'";
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
}
|
||||||
if (!$this->db->sql_affectedrows())
|
else
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO ' . $this->extension_table . '
|
$sql = 'INSERT INTO ' . $this->extension_table . '
|
||||||
' . $this->db->sql_build_array('INSERT', $extension_data);
|
' . $this->db->sql_build_array('INSERT', $extension_data);
|
||||||
|
@ -335,12 +337,6 @@ class phpbb_extension_manager
|
||||||
|
|
||||||
$old_state = unserialize($this->extensions[$name]['ext_state']);
|
$old_state = unserialize($this->extensions[$name]['ext_state']);
|
||||||
|
|
||||||
// Returns false if not completed
|
|
||||||
if (!$this->handle_migrations($name, 'purge'))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$extension = $this->get_extension($name);
|
$extension = $this->get_extension($name);
|
||||||
$state = $extension->purge_step($old_state);
|
$state = $extension->purge_step($old_state);
|
||||||
|
|
||||||
|
@ -514,72 +510,4 @@ class phpbb_extension_manager
|
||||||
{
|
{
|
||||||
return new phpbb_extension_finder($this, $this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
|
return new phpbb_extension_finder($this, $this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle installing/reverting migrations
|
|
||||||
*
|
|
||||||
* @param string $extension_name Name of the extension
|
|
||||||
* @param string $mode enable or purge
|
|
||||||
* @return bool True if completed, False if not completed
|
|
||||||
*/
|
|
||||||
protected function handle_migrations($extension_name, $mode)
|
|
||||||
{
|
|
||||||
$extensions = array(
|
|
||||||
$extension_name => $this->phpbb_root_path . $this->get_extension_path($extension_name),
|
|
||||||
);
|
|
||||||
|
|
||||||
$finder = $this->get_finder();
|
|
||||||
$migrations = array();
|
|
||||||
$file_list = $finder
|
|
||||||
->extension_directory('/migrations')
|
|
||||||
->find_from_paths($extensions);
|
|
||||||
|
|
||||||
if (empty($file_list))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($file_list as $file)
|
|
||||||
{
|
|
||||||
$migrations[$file['named_path']] = $file['ext_name'];
|
|
||||||
}
|
|
||||||
$migrations = $finder->get_classes_from_files($migrations);
|
|
||||||
$this->migrator->set_migrations($migrations);
|
|
||||||
|
|
||||||
// What is a safe limit of execution time? Half the max execution time should be safe.
|
|
||||||
$safe_time_limit = (ini_get('max_execution_time') / 2);
|
|
||||||
$start_time = time();
|
|
||||||
|
|
||||||
if ($mode == 'enable')
|
|
||||||
{
|
|
||||||
while (!$this->migrator->finished())
|
|
||||||
{
|
|
||||||
$this->migrator->update();
|
|
||||||
|
|
||||||
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
|
||||||
if ((time() - $start_time) >= $safe_time_limit)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($mode == 'purge')
|
|
||||||
{
|
|
||||||
foreach ($migrations as $migration)
|
|
||||||
{
|
|
||||||
while ($this->migrator->migration_state($migration) !== false)
|
|
||||||
{
|
|
||||||
$this->migrator->revert($migration);
|
|
||||||
|
|
||||||
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
|
||||||
if ((time() - $start_time) >= $safe_time_limit)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,31 +22,64 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
class phpbb_extension_metadata_manager
|
class phpbb_extension_metadata_manager
|
||||||
{
|
{
|
||||||
protected $phpEx;
|
/**
|
||||||
|
* phpBB Config instance
|
||||||
|
* @var phpbb_config
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* phpBB Extension Manager
|
||||||
|
* @var phpbb_extension_manager
|
||||||
|
*/
|
||||||
protected $extension_manager;
|
protected $extension_manager;
|
||||||
protected $db;
|
|
||||||
protected $phpbb_root_path;
|
/**
|
||||||
|
* phpBB Template instance
|
||||||
|
* @var phpbb_template
|
||||||
|
*/
|
||||||
protected $template;
|
protected $template;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* phpBB root path
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name (including vendor) of the extension
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $ext_name;
|
protected $ext_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metadata from the composer.json file
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
protected $metadata;
|
protected $metadata;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link (including root path) to the metadata file
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $metadata_file;
|
protected $metadata_file;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the metadata manager
|
* Creates the metadata manager
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db A database connection
|
* @param string $ext_name Name (including vendor) of the extension
|
||||||
* @param string $extension_manager An instance of the phpbb extension manager
|
* @param phpbb_config $config phpBB Config instance
|
||||||
|
* @param phpbb_extension_manager $extension_manager An instance of the phpBBb extension manager
|
||||||
|
* @param phpbb_template $template phpBB Template instance
|
||||||
* @param string $phpbb_root_path Path to the phpbb includes directory.
|
* @param string $phpbb_root_path Path to the phpbb includes directory.
|
||||||
* @param string $phpEx php file extension
|
|
||||||
*/
|
*/
|
||||||
public function __construct($ext_name, phpbb_db_driver $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = 'php', phpbb_template $template, phpbb_config $config)
|
public function __construct($ext_name, phpbb_config $config, phpbb_extension_manager $extension_manager, phpbb_template $template, $phpbb_root_path)
|
||||||
{
|
{
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
|
||||||
$this->db = $db;
|
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->phpEx = $phpEx;
|
|
||||||
$this->template = $template;
|
|
||||||
$this->extension_manager = $extension_manager;
|
$this->extension_manager = $extension_manager;
|
||||||
|
$this->template = $template;
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
|
||||||
$this->ext_name = $ext_name;
|
$this->ext_name = $ext_name;
|
||||||
$this->metadata = array();
|
$this->metadata = array();
|
||||||
$this->metadata_file = '';
|
$this->metadata_file = '';
|
||||||
|
|
259
phpBB/includes/feed/base.php
Normal file
259
phpBB/includes/feed/base.php
Normal file
|
@ -0,0 +1,259 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class with some generic functions and settings.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
abstract class phpbb_feed_base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Feed helper object
|
||||||
|
* @var phpbb_feed_helper
|
||||||
|
*/
|
||||||
|
protected $helper;
|
||||||
|
|
||||||
|
/** @var phpbb_config */
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/** @var phpbb_db_driver */
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
/** @var phpbb_cache_driver_interface */
|
||||||
|
protected $cache;
|
||||||
|
|
||||||
|
/** @var phpbb_user */
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
/** @var phpbb_auth */
|
||||||
|
protected $auth;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $phpEx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SQL Query to be executed to get feed items
|
||||||
|
*/
|
||||||
|
var $sql = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keys specified for retrieval of title, content, etc.
|
||||||
|
*/
|
||||||
|
var $keys = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of items to fetch. Usually overwritten by $config['feed_something']
|
||||||
|
*/
|
||||||
|
var $num_items = 15;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separator for title elements to separate items (for example forum / topic)
|
||||||
|
*/
|
||||||
|
var $separator = "\xE2\x80\xA2"; // •
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separator for the statistics row (Posted by, post date, replies, etc.)
|
||||||
|
*/
|
||||||
|
var $separator_stats = "\xE2\x80\x94"; // —
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param phpbb_feed_helper $helper Feed helper
|
||||||
|
* @param phpbb_config $config Config object
|
||||||
|
* @param phpbb_db_driver $db Database connection
|
||||||
|
* @param phpbb_cache_driver_interface $cache Cache object
|
||||||
|
* @param phpbb_user $user User object
|
||||||
|
* @param phpbb_auth $auth Auth object
|
||||||
|
* @param string $phpEx php file extension
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, $phpEx)
|
||||||
|
{
|
||||||
|
$this->config = $config;
|
||||||
|
$this->helper = $helper;
|
||||||
|
$this->db = $db;
|
||||||
|
$this->cache = $cache;
|
||||||
|
$this->user = $user;
|
||||||
|
$this->auth = $auth;
|
||||||
|
$this->phpEx = $phpEx;
|
||||||
|
|
||||||
|
$this->set_keys();
|
||||||
|
|
||||||
|
// Allow num_items to be string
|
||||||
|
if (is_string($this->num_items))
|
||||||
|
{
|
||||||
|
$this->num_items = (int) $this->config[$this->num_items];
|
||||||
|
|
||||||
|
// A precaution
|
||||||
|
if (!$this->num_items)
|
||||||
|
{
|
||||||
|
$this->num_items = 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set keys.
|
||||||
|
*/
|
||||||
|
function set_keys()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open feed
|
||||||
|
*/
|
||||||
|
function open()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close feed
|
||||||
|
*/
|
||||||
|
function close()
|
||||||
|
{
|
||||||
|
if (!empty($this->result))
|
||||||
|
{
|
||||||
|
$this->db->sql_freeresult($this->result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set key
|
||||||
|
*/
|
||||||
|
function set($key, $value)
|
||||||
|
{
|
||||||
|
$this->keys[$key] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get key
|
||||||
|
*/
|
||||||
|
function get($key)
|
||||||
|
{
|
||||||
|
return (isset($this->keys[$key])) ? $this->keys[$key] : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_readable_forums()
|
||||||
|
{
|
||||||
|
static $forum_ids;
|
||||||
|
|
||||||
|
if (!isset($forum_ids))
|
||||||
|
{
|
||||||
|
$forum_ids = array_keys($this->auth->acl_getf('f_read', true));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $forum_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_moderator_approve_forums()
|
||||||
|
{
|
||||||
|
static $forum_ids;
|
||||||
|
|
||||||
|
if (!isset($forum_ids))
|
||||||
|
{
|
||||||
|
$forum_ids = array_keys($this->auth->acl_getf('m_approve', true));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $forum_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_moderator_approve_forum($forum_id)
|
||||||
|
{
|
||||||
|
static $forum_ids;
|
||||||
|
|
||||||
|
if (!isset($forum_ids))
|
||||||
|
{
|
||||||
|
$forum_ids = array_flip($this->get_moderator_approve_forums());
|
||||||
|
}
|
||||||
|
|
||||||
|
return (isset($forum_ids[$forum_id])) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_excluded_forums()
|
||||||
|
{
|
||||||
|
static $forum_ids;
|
||||||
|
|
||||||
|
// Matches acp/acp_board.php
|
||||||
|
$cache_name = 'feed_excluded_forum_ids';
|
||||||
|
|
||||||
|
if (!isset($forum_ids) && ($forum_ids = $this->cache->get('_' . $cache_name)) === false)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT forum_id
|
||||||
|
FROM ' . FORUMS_TABLE . '
|
||||||
|
WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_EXCLUDE, '<> 0');
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
|
$forum_ids = array();
|
||||||
|
while ($forum_id = (int) $this->db->sql_fetchfield('forum_id'))
|
||||||
|
{
|
||||||
|
$forum_ids[$forum_id] = $forum_id;
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$this->cache->put('_' . $cache_name, $forum_ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $forum_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_excluded_forum($forum_id)
|
||||||
|
{
|
||||||
|
$forum_ids = $this->get_excluded_forums();
|
||||||
|
|
||||||
|
return isset($forum_ids[$forum_id]) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_passworded_forums()
|
||||||
|
{
|
||||||
|
return $this->user->get_passworded_forums();
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_item()
|
||||||
|
{
|
||||||
|
static $result;
|
||||||
|
|
||||||
|
if (!isset($result))
|
||||||
|
{
|
||||||
|
if (!$this->get_sql())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query database
|
||||||
|
$sql = $this->db->sql_build_query('SELECT', $this->sql);
|
||||||
|
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->db->sql_fetchrow($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
function user_viewprofile($row)
|
||||||
|
{
|
||||||
|
$author_id = (int) $row[$this->get('author_id')];
|
||||||
|
|
||||||
|
if ($author_id == ANONYMOUS)
|
||||||
|
{
|
||||||
|
// Since we cannot link to a profile, we just return GUEST
|
||||||
|
// instead of $row['username']
|
||||||
|
return $this->user->lang['GUEST'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<a href="' . $this->helper->append_sid('memberlist.' . $this->phpEx, 'mode=viewprofile&u=' . $author_id) . '">' . $row[$this->get('creator')] . '</a>';
|
||||||
|
}
|
||||||
|
}
|
129
phpBB/includes/feed/factory.php
Normal file
129
phpBB/includes/feed/factory.php
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory class to return correct object
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_feed_factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Service container object
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
protected $container;
|
||||||
|
|
||||||
|
/** @var phpbb_config */
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/** @var phpbb_db_driver */
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param objec $container Container object
|
||||||
|
* @param phpbb_config $config Config object
|
||||||
|
* @param phpbb_db_driver $db Database connection
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function __construct($container, phpbb_config $config, phpbb_db_driver $db)
|
||||||
|
{
|
||||||
|
$this->container = $container;
|
||||||
|
$this->config = $config;
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return correct object for specified mode
|
||||||
|
*
|
||||||
|
* @param string $mode The feeds mode.
|
||||||
|
* @param int $forum_id Forum id specified by the script if forum feed provided.
|
||||||
|
* @param int $topic_id Topic id specified by the script if topic feed provided.
|
||||||
|
*
|
||||||
|
* @return object Returns correct feeds object for specified mode.
|
||||||
|
*/
|
||||||
|
function get_feed($mode, $forum_id, $topic_id)
|
||||||
|
{
|
||||||
|
switch ($mode)
|
||||||
|
{
|
||||||
|
case 'forums':
|
||||||
|
if (!$this->config['feed_overall_forums'])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->container->get('feed.forums');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'topics':
|
||||||
|
case 'topics_new':
|
||||||
|
if (!$this->config['feed_topics_new'])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->container->get('feed.topics');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'topics_active':
|
||||||
|
if (!$this->config['feed_topics_active'])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->container->get('feed.topics_active');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'news':
|
||||||
|
// Get at least one news forum
|
||||||
|
$sql = 'SELECT forum_id
|
||||||
|
FROM ' . FORUMS_TABLE . '
|
||||||
|
WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0');
|
||||||
|
$result = $this->db->sql_query_limit($sql, 1, 0, 600);
|
||||||
|
$s_feed_news = (int) $this->db->sql_fetchfield('forum_id');
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (!$s_feed_news)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->container->get('feed.news');
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if ($topic_id && $this->config['feed_topic'])
|
||||||
|
{
|
||||||
|
return $this->container->get('feed.topic')
|
||||||
|
->set_topic_id($topic_id);
|
||||||
|
}
|
||||||
|
else if ($forum_id && $this->config['feed_forum'])
|
||||||
|
{
|
||||||
|
return $this->container->get('feed.forum')
|
||||||
|
->set_forum_id($forum_id);
|
||||||
|
}
|
||||||
|
else if ($this->config['feed_overall'])
|
||||||
|
{
|
||||||
|
return $this->container->get('feed.overall');
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
147
phpBB/includes/feed/forum.php
Normal file
147
phpBB/includes/feed/forum.php
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forum feed
|
||||||
|
*
|
||||||
|
* This will give you the last {$this->num_items} posts made
|
||||||
|
* within a specific forum.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_feed_forum extends phpbb_feed_post_base
|
||||||
|
{
|
||||||
|
var $forum_id = 0;
|
||||||
|
var $forum_data = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Forum ID
|
||||||
|
*
|
||||||
|
* @param int $forum_id Forum ID
|
||||||
|
* @return phpbb_feed_forum
|
||||||
|
*/
|
||||||
|
public function set_forum_id($topic_id)
|
||||||
|
{
|
||||||
|
$this->forum_id = (int) $forum_id;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
function open()
|
||||||
|
{
|
||||||
|
// Check if forum exists
|
||||||
|
$sql = 'SELECT forum_id, forum_name, forum_password, forum_type, forum_options
|
||||||
|
FROM ' . FORUMS_TABLE . '
|
||||||
|
WHERE forum_id = ' . $this->forum_id;
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$this->forum_data = $this->db->sql_fetchrow($result);
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($this->forum_data))
|
||||||
|
{
|
||||||
|
trigger_error('NO_FORUM');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forum needs to be postable
|
||||||
|
if ($this->forum_data['forum_type'] != FORUM_POST)
|
||||||
|
{
|
||||||
|
trigger_error('NO_FEED');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure forum is not excluded from feed
|
||||||
|
if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->forum_data['forum_options']))
|
||||||
|
{
|
||||||
|
trigger_error('NO_FEED');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure we can read this forum
|
||||||
|
if (!$this->auth->acl_get('f_read', $this->forum_id))
|
||||||
|
{
|
||||||
|
trigger_error('SORRY_AUTH_READ');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure forum is not passworded or user is authed
|
||||||
|
if ($this->forum_data['forum_password'])
|
||||||
|
{
|
||||||
|
$forum_ids_passworded = $this->get_passworded_forums();
|
||||||
|
|
||||||
|
if (isset($forum_ids_passworded[$this->forum_id]))
|
||||||
|
{
|
||||||
|
trigger_error('SORRY_AUTH_READ');
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($forum_ids_passworded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sql()
|
||||||
|
{
|
||||||
|
$m_approve = ($this->auth->acl_get('m_approve', $this->forum_id)) ? true : false;
|
||||||
|
|
||||||
|
// Determine topics with recent activity
|
||||||
|
$sql = 'SELECT topic_id, topic_last_post_time
|
||||||
|
FROM ' . TOPICS_TABLE . '
|
||||||
|
WHERE forum_id = ' . $this->forum_id . '
|
||||||
|
AND topic_moved_id = 0
|
||||||
|
' . ((!$m_approve) ? 'AND topic_approved = 1' : '') . '
|
||||||
|
ORDER BY topic_last_post_time DESC';
|
||||||
|
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||||
|
|
||||||
|
$topic_ids = array();
|
||||||
|
$min_post_time = 0;
|
||||||
|
while ($row = $this->db->sql_fetchrow())
|
||||||
|
{
|
||||||
|
$topic_ids[] = (int) $row['topic_id'];
|
||||||
|
|
||||||
|
$min_post_time = (int) $row['topic_last_post_time'];
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($topic_ids))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sql = array(
|
||||||
|
'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
||||||
|
'u.username, u.user_id',
|
||||||
|
'FROM' => array(
|
||||||
|
POSTS_TABLE => 'p',
|
||||||
|
USERS_TABLE => 'u',
|
||||||
|
),
|
||||||
|
'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . '
|
||||||
|
' . ((!$m_approve) ? 'AND p.post_approved = 1' : '') . '
|
||||||
|
AND p.post_time >= ' . $min_post_time . '
|
||||||
|
AND p.poster_id = u.user_id',
|
||||||
|
'ORDER_BY' => 'p.post_time DESC',
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function adjust_item(&$item_row, &$row)
|
||||||
|
{
|
||||||
|
parent::adjust_item($item_row, $row);
|
||||||
|
|
||||||
|
$item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_item()
|
||||||
|
{
|
||||||
|
return ($row = parent::get_item()) ? array_merge($this->forum_data, $row) : $row;
|
||||||
|
}
|
||||||
|
}
|
72
phpBB/includes/feed/forums.php
Normal file
72
phpBB/includes/feed/forums.php
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 'All Forums' feed
|
||||||
|
*
|
||||||
|
* This will give you a list of all postable forums where feeds are enabled
|
||||||
|
* including forum description, topic stats and post stats
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_feed_forums extends phpbb_feed_base
|
||||||
|
{
|
||||||
|
var $num_items = 0;
|
||||||
|
|
||||||
|
function set_keys()
|
||||||
|
{
|
||||||
|
$this->set('title', 'forum_name');
|
||||||
|
$this->set('text', 'forum_desc');
|
||||||
|
$this->set('bitfield', 'forum_desc_bitfield');
|
||||||
|
$this->set('bbcode_uid','forum_desc_uid');
|
||||||
|
$this->set('updated', 'forum_last_post_time');
|
||||||
|
$this->set('options', 'forum_desc_options');
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sql()
|
||||||
|
{
|
||||||
|
$in_fid_ary = array_diff($this->get_readable_forums(), $this->get_excluded_forums());
|
||||||
|
if (empty($in_fid_ary))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build SQL Query
|
||||||
|
$this->sql = array(
|
||||||
|
'SELECT' => 'f.forum_id, f.left_id, f.forum_name, f.forum_last_post_time,
|
||||||
|
f.forum_desc, f.forum_desc_bitfield, f.forum_desc_uid, f.forum_desc_options,
|
||||||
|
f.forum_topics, f.forum_posts',
|
||||||
|
'FROM' => array(FORUMS_TABLE => 'f'),
|
||||||
|
'WHERE' => 'f.forum_type = ' . FORUM_POST . '
|
||||||
|
AND ' . $this->db->sql_in_set('f.forum_id', $in_fid_ary),
|
||||||
|
'ORDER_BY' => 'f.left_id ASC',
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function adjust_item(&$item_row, &$row)
|
||||||
|
{
|
||||||
|
$item_row['link'] = $this->helper->append_sid('viewforum.' . $this->phpEx, 'f=' . $row['forum_id']);
|
||||||
|
|
||||||
|
if ($this->config['feed_item_statistics'])
|
||||||
|
{
|
||||||
|
$item_row['statistics'] = $this->user->lang('TOTAL_TOPICS', (int) $row['forum_topics'])
|
||||||
|
. ' ' . $this->separator_stats . ' ' . $this->user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
159
phpBB/includes/feed/helper.php
Normal file
159
phpBB/includes/feed/helper.php
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class with some helpful functions used in feeds
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_feed_helper
|
||||||
|
{
|
||||||
|
/** @var phpbb_config */
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/** @var phpbb_user */
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param phpbb_config $config Config object
|
||||||
|
* @param phpbb_user $user User object
|
||||||
|
* @param string $phpbb_root_path Root path
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function __construct(phpbb_config $config, phpbb_user $user, $phpbb_root_path)
|
||||||
|
{
|
||||||
|
$this->config = $config;
|
||||||
|
$this->user = $user;
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run links through append_sid(), prepend generate_board_url() and remove session id
|
||||||
|
*/
|
||||||
|
public function get_board_url()
|
||||||
|
{
|
||||||
|
static $board_url;
|
||||||
|
|
||||||
|
if (empty($board_url))
|
||||||
|
{
|
||||||
|
$board_url = generate_board_url();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $board_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run links through append_sid(), prepend generate_board_url() and remove session id
|
||||||
|
*/
|
||||||
|
public function append_sid($url, $params)
|
||||||
|
{
|
||||||
|
return append_sid($this->get_board_url() . '/' . $url, $params, true, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate ISO 8601 date string (RFC 3339)
|
||||||
|
*/
|
||||||
|
public function format_date($time)
|
||||||
|
{
|
||||||
|
static $zone_offset;
|
||||||
|
static $offset_string;
|
||||||
|
|
||||||
|
if (empty($offset_string))
|
||||||
|
{
|
||||||
|
$zone_offset = $this->user->create_datetime()->getOffset();
|
||||||
|
$offset_string = phpbb_format_timezone_offset($zone_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gmdate("Y-m-d\TH:i:s", $time + $zone_offset) . $offset_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate text content
|
||||||
|
*/
|
||||||
|
public function generate_content($content, $uid, $bitfield, $options)
|
||||||
|
{
|
||||||
|
if (empty($content))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare some bbcodes for better parsing
|
||||||
|
$content = preg_replace("#\[quote(=".*?")?:$uid\]\s*(.*?)\s*\[/quote:$uid\]#si", "[quote$1:$uid]<br />$2<br />[/quote:$uid]", $content);
|
||||||
|
|
||||||
|
$content = generate_text_for_display($content, $uid, $bitfield, $options);
|
||||||
|
|
||||||
|
// Add newlines
|
||||||
|
$content = str_replace('<br />', '<br />' . "\n", $content);
|
||||||
|
|
||||||
|
// Convert smiley Relative paths to Absolute path, Windows style
|
||||||
|
$content = str_replace($this->phpbb_root_path . $this->config['smilies_path'], $this->get_board_url() . '/' . $this->config['smilies_path'], $content);
|
||||||
|
|
||||||
|
// Remove "Select all" link and mouse events
|
||||||
|
$content = str_replace('<a href="#" onclick="selectCode(this); return false;">' . $this->user->lang['SELECT_ALL_CODE'] . '</a>', '', $content);
|
||||||
|
$content = preg_replace('#(onkeypress|onclick)="(.*?)"#si', '', $content);
|
||||||
|
|
||||||
|
// Firefox does not support CSS for feeds, though
|
||||||
|
|
||||||
|
// Remove font sizes
|
||||||
|
// $content = preg_replace('#<span style="font-size: [0-9]+%; line-height: [0-9]+%;">([^>]+)</span>#iU', '\1', $content);
|
||||||
|
|
||||||
|
// Make text strong :P
|
||||||
|
// $content = preg_replace('#<span style="font-weight: bold?">(.*?)</span>#iU', '<strong>\1</strong>', $content);
|
||||||
|
|
||||||
|
// Italic
|
||||||
|
// $content = preg_replace('#<span style="font-style: italic?">([^<]+)</span>#iU', '<em>\1</em>', $content);
|
||||||
|
|
||||||
|
// Underline
|
||||||
|
// $content = preg_replace('#<span style="text-decoration: underline?">([^<]+)</span>#iU', '<u>\1</u>', $content);
|
||||||
|
|
||||||
|
// Remove embed Windows Media Streams
|
||||||
|
$content = preg_replace( '#<\!--\[if \!IE\]>-->([^[]+)<\!--<!\[endif\]-->#si', '', $content);
|
||||||
|
|
||||||
|
// Do not use < and >, because we want to retain code contained in [code][/code]
|
||||||
|
|
||||||
|
// Remove embed and objects
|
||||||
|
$content = preg_replace( '#<(object|embed)(.*?) (value|src)=(.*?) ([^[]+)(object|embed)>#si',' <a href=$4 target="_blank"><strong>$1</strong></a> ',$content);
|
||||||
|
|
||||||
|
// Remove some specials html tag, because somewhere there are a mod to allow html tags ;)
|
||||||
|
$content = preg_replace( '#<(script|iframe)([^[]+)\1>#siU', ' <strong>$1</strong> ', $content);
|
||||||
|
|
||||||
|
// Remove Comments from inline attachments [ia]
|
||||||
|
$content = preg_replace('#<div class="(inline-attachment|attachtitle)">(.*?)<!-- ia(.*?) -->(.*?)<!-- ia(.*?) -->(.*?)</div>#si','$4',$content);
|
||||||
|
|
||||||
|
// Replace some entities with their unicode counterpart
|
||||||
|
$entities = array(
|
||||||
|
' ' => "\xC2\xA0",
|
||||||
|
'•' => "\xE2\x80\xA2",
|
||||||
|
'·' => "\xC2\xB7",
|
||||||
|
'©' => "\xC2\xA9",
|
||||||
|
);
|
||||||
|
|
||||||
|
$content = str_replace(array_keys($entities), array_values($entities), $content);
|
||||||
|
|
||||||
|
// Remove CDATA blocks. ;)
|
||||||
|
$content = preg_replace('#\<\!\[CDATA\[(.*?)\]\]\>#s', '', $content);
|
||||||
|
|
||||||
|
// Other control characters
|
||||||
|
$content = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $content);
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
112
phpBB/includes/feed/news.php
Normal file
112
phpBB/includes/feed/news.php
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* News feed
|
||||||
|
*
|
||||||
|
* This will give you {$this->num_items} first posts
|
||||||
|
* of all topics in the selected news forums.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_feed_news extends phpbb_feed_topic_base
|
||||||
|
{
|
||||||
|
function get_news_forums()
|
||||||
|
{
|
||||||
|
static $forum_ids;
|
||||||
|
|
||||||
|
// Matches acp/acp_board.php
|
||||||
|
$cache_name = 'feed_news_forum_ids';
|
||||||
|
|
||||||
|
if (!isset($forum_ids) && ($forum_ids = $this->cache->get('_' . $cache_name)) === false)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT forum_id
|
||||||
|
FROM ' . FORUMS_TABLE . '
|
||||||
|
WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0');
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
|
$forum_ids = array();
|
||||||
|
while ($forum_id = (int) $this->db->sql_fetchfield('forum_id'))
|
||||||
|
{
|
||||||
|
$forum_ids[$forum_id] = $forum_id;
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$this->cache->put('_' . $cache_name, $forum_ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $forum_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sql()
|
||||||
|
{
|
||||||
|
// Determine forum ids
|
||||||
|
$in_fid_ary = array_intersect($this->get_news_forums(), $this->get_readable_forums());
|
||||||
|
if (empty($in_fid_ary))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$in_fid_ary = array_diff($in_fid_ary, $this->get_passworded_forums());
|
||||||
|
if (empty($in_fid_ary))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We really have to get the post ids first!
|
||||||
|
$sql = 'SELECT topic_first_post_id, topic_time
|
||||||
|
FROM ' . TOPICS_TABLE . '
|
||||||
|
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
|
||||||
|
AND topic_moved_id = 0
|
||||||
|
AND topic_approved = 1
|
||||||
|
ORDER BY topic_time DESC';
|
||||||
|
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||||
|
|
||||||
|
$post_ids = array();
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$post_ids[] = (int) $row['topic_first_post_id'];
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($post_ids))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sql = array(
|
||||||
|
'SELECT' => 'f.forum_id, f.forum_name,
|
||||||
|
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time,
|
||||||
|
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
|
||||||
|
'FROM' => array(
|
||||||
|
TOPICS_TABLE => 't',
|
||||||
|
POSTS_TABLE => 'p',
|
||||||
|
),
|
||||||
|
'LEFT_JOIN' => array(
|
||||||
|
array(
|
||||||
|
'FROM' => array(FORUMS_TABLE => 'f'),
|
||||||
|
'ON' => 'p.forum_id = f.forum_id',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'WHERE' => 'p.topic_id = t.topic_id
|
||||||
|
AND ' . $this->db->sql_in_set('p.post_id', $post_ids),
|
||||||
|
'ORDER_BY' => 'p.post_time DESC',
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
97
phpBB/includes/feed/overall.php
Normal file
97
phpBB/includes/feed/overall.php
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Board wide feed (aka overall feed)
|
||||||
|
*
|
||||||
|
* This will give you the newest {$this->num_items} posts
|
||||||
|
* from the whole board.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_feed_overall extends phpbb_feed_post_base
|
||||||
|
{
|
||||||
|
function get_sql()
|
||||||
|
{
|
||||||
|
$forum_ids = array_diff($this->get_readable_forums(), $this->get_excluded_forums(), $this->get_passworded_forums());
|
||||||
|
if (empty($forum_ids))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// m_approve forums
|
||||||
|
$fid_m_approve = $this->get_moderator_approve_forums();
|
||||||
|
$sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $this->db->sql_in_set('forum_id', $fid_m_approve) : '';
|
||||||
|
|
||||||
|
// Determine topics with recent activity
|
||||||
|
$sql = 'SELECT topic_id, topic_last_post_time
|
||||||
|
FROM ' . TOPICS_TABLE . '
|
||||||
|
WHERE ' . $this->db->sql_in_set('forum_id', $forum_ids) . '
|
||||||
|
AND topic_moved_id = 0
|
||||||
|
AND (topic_approved = 1
|
||||||
|
' . $sql_m_approve . ')
|
||||||
|
ORDER BY topic_last_post_time DESC';
|
||||||
|
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||||
|
|
||||||
|
$topic_ids = array();
|
||||||
|
$min_post_time = 0;
|
||||||
|
while ($row = $this->db->sql_fetchrow())
|
||||||
|
{
|
||||||
|
$topic_ids[] = (int) $row['topic_id'];
|
||||||
|
|
||||||
|
$min_post_time = (int) $row['topic_last_post_time'];
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($topic_ids))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the actual data
|
||||||
|
$this->sql = array(
|
||||||
|
'SELECT' => 'f.forum_id, f.forum_name, ' .
|
||||||
|
'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
||||||
|
'u.username, u.user_id',
|
||||||
|
'FROM' => array(
|
||||||
|
USERS_TABLE => 'u',
|
||||||
|
POSTS_TABLE => 'p',
|
||||||
|
),
|
||||||
|
'LEFT_JOIN' => array(
|
||||||
|
array(
|
||||||
|
'FROM' => array(FORUMS_TABLE => 'f'),
|
||||||
|
'ON' => 'f.forum_id = p.forum_id',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . '
|
||||||
|
AND (p.post_approved = 1
|
||||||
|
' . str_replace('forum_id', 'p.forum_id', $sql_m_approve) . ')
|
||||||
|
AND p.post_time >= ' . $min_post_time . '
|
||||||
|
AND u.user_id = p.poster_id',
|
||||||
|
'ORDER_BY' => 'p.post_time DESC',
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function adjust_item(&$item_row, &$row)
|
||||||
|
{
|
||||||
|
parent::adjust_item($item_row, $row);
|
||||||
|
|
||||||
|
$item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title'];
|
||||||
|
}
|
||||||
|
}
|
57
phpBB/includes/feed/post_base.php
Normal file
57
phpBB/includes/feed/post_base.php
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for post based feeds
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
abstract class phpbb_feed_post_base extends phpbb_feed_base
|
||||||
|
{
|
||||||
|
var $num_items = 'feed_limit_post';
|
||||||
|
|
||||||
|
function set_keys()
|
||||||
|
{
|
||||||
|
$this->set('title', 'post_subject');
|
||||||
|
$this->set('title2', 'topic_title');
|
||||||
|
|
||||||
|
$this->set('author_id', 'user_id');
|
||||||
|
$this->set('creator', 'username');
|
||||||
|
$this->set('published', 'post_time');
|
||||||
|
$this->set('updated', 'post_edit_time');
|
||||||
|
$this->set('text', 'post_text');
|
||||||
|
|
||||||
|
$this->set('bitfield', 'bbcode_bitfield');
|
||||||
|
$this->set('bbcode_uid','bbcode_uid');
|
||||||
|
|
||||||
|
$this->set('enable_bbcode', 'enable_bbcode');
|
||||||
|
$this->set('enable_smilies', 'enable_smilies');
|
||||||
|
$this->set('enable_magic_url', 'enable_magic_url');
|
||||||
|
}
|
||||||
|
|
||||||
|
function adjust_item(&$item_row, &$row)
|
||||||
|
{
|
||||||
|
$item_row['link'] = $this->helper->append_sid('viewtopic.' . $this->phpEx, "t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}");
|
||||||
|
|
||||||
|
if ($this->config['feed_item_statistics'])
|
||||||
|
{
|
||||||
|
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
||||||
|
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
|
||||||
|
. (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
116
phpBB/includes/feed/topic.php
Normal file
116
phpBB/includes/feed/topic.php
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Topic feed for a specific topic
|
||||||
|
*
|
||||||
|
* This will give you the last {$this->num_items} posts made within this topic.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_feed_topic extends phpbb_feed_post_base
|
||||||
|
{
|
||||||
|
var $topic_id = 0;
|
||||||
|
var $forum_id = 0;
|
||||||
|
var $topic_data = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Topic ID
|
||||||
|
*
|
||||||
|
* @param int $topic_id Topic ID
|
||||||
|
* @return phpbb_feed_topic
|
||||||
|
*/
|
||||||
|
public function set_topic_id($topic_id)
|
||||||
|
{
|
||||||
|
$this->topic_id = (int) $topic_id;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
function open()
|
||||||
|
{
|
||||||
|
$sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_approved, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type
|
||||||
|
FROM ' . TOPICS_TABLE . ' t
|
||||||
|
LEFT JOIN ' . FORUMS_TABLE . ' f
|
||||||
|
ON (f.forum_id = t.forum_id)
|
||||||
|
WHERE t.topic_id = ' . $this->topic_id;
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$this->topic_data = $this->db->sql_fetchrow($result);
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($this->topic_data))
|
||||||
|
{
|
||||||
|
trigger_error('NO_TOPIC');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->forum_id = (int) $this->topic_data['forum_id'];
|
||||||
|
|
||||||
|
// Make sure topic is either approved or user authed
|
||||||
|
if (!$this->topic_data['topic_approved'] && !$this->auth->acl_get('m_approve', $this->forum_id))
|
||||||
|
{
|
||||||
|
trigger_error('SORRY_AUTH_READ');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure forum is not excluded from feed
|
||||||
|
if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->topic_data['forum_options']))
|
||||||
|
{
|
||||||
|
trigger_error('NO_FEED');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure we can read this forum
|
||||||
|
if (!$this->auth->acl_get('f_read', $this->forum_id))
|
||||||
|
{
|
||||||
|
trigger_error('SORRY_AUTH_READ');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure forum is not passworded or user is authed
|
||||||
|
if ($this->topic_data['forum_password'])
|
||||||
|
{
|
||||||
|
$forum_ids_passworded = $this->get_passworded_forums();
|
||||||
|
|
||||||
|
if (isset($forum_ids_passworded[$this->forum_id]))
|
||||||
|
{
|
||||||
|
trigger_error('SORRY_AUTH_READ');
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($forum_ids_passworded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sql()
|
||||||
|
{
|
||||||
|
$this->sql = array(
|
||||||
|
'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
||||||
|
'u.username, u.user_id',
|
||||||
|
'FROM' => array(
|
||||||
|
POSTS_TABLE => 'p',
|
||||||
|
USERS_TABLE => 'u',
|
||||||
|
),
|
||||||
|
'WHERE' => 'p.topic_id = ' . $this->topic_id . '
|
||||||
|
' . ($this->forum_id && !$this->auth->acl_get('m_approve', $this->forum_id) ? 'AND p.post_approved = 1' : '') . '
|
||||||
|
AND p.poster_id = u.user_id',
|
||||||
|
'ORDER_BY' => 'p.post_time DESC',
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_item()
|
||||||
|
{
|
||||||
|
return ($row = parent::get_item()) ? array_merge($this->topic_data, $row) : $row;
|
||||||
|
}
|
||||||
|
}
|
59
phpBB/includes/feed/topic_base.php
Normal file
59
phpBB/includes/feed/topic_base.php
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for topic based feeds
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
abstract class phpbb_feed_topic_base extends phpbb_feed_base
|
||||||
|
{
|
||||||
|
var $num_items = 'feed_limit_topic';
|
||||||
|
|
||||||
|
function set_keys()
|
||||||
|
{
|
||||||
|
$this->set('title', 'topic_title');
|
||||||
|
$this->set('title2', 'forum_name');
|
||||||
|
|
||||||
|
$this->set('author_id', 'topic_poster');
|
||||||
|
$this->set('creator', 'topic_first_poster_name');
|
||||||
|
$this->set('published', 'post_time');
|
||||||
|
$this->set('updated', 'post_edit_time');
|
||||||
|
$this->set('text', 'post_text');
|
||||||
|
|
||||||
|
$this->set('bitfield', 'bbcode_bitfield');
|
||||||
|
$this->set('bbcode_uid','bbcode_uid');
|
||||||
|
|
||||||
|
$this->set('enable_bbcode', 'enable_bbcode');
|
||||||
|
$this->set('enable_smilies', 'enable_smilies');
|
||||||
|
$this->set('enable_magic_url', 'enable_magic_url');
|
||||||
|
}
|
||||||
|
|
||||||
|
function adjust_item(&$item_row, &$row)
|
||||||
|
{
|
||||||
|
$item_row['link'] = $this->helper->append_sid('viewtopic.' . $this->phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']);
|
||||||
|
|
||||||
|
if ($this->config['feed_item_statistics'])
|
||||||
|
{
|
||||||
|
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
||||||
|
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
|
||||||
|
. ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'])
|
||||||
|
. ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views']
|
||||||
|
. (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
91
phpBB/includes/feed/topics.php
Normal file
91
phpBB/includes/feed/topics.php
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New Topics feed
|
||||||
|
*
|
||||||
|
* This will give you the last {$this->num_items} created topics
|
||||||
|
* including the first post.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_feed_topics extends phpbb_feed_topic_base
|
||||||
|
{
|
||||||
|
function get_sql()
|
||||||
|
{
|
||||||
|
$forum_ids_read = $this->get_readable_forums();
|
||||||
|
if (empty($forum_ids_read))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$in_fid_ary = array_diff($forum_ids_read, $this->get_excluded_forums(), $this->get_passworded_forums());
|
||||||
|
if (empty($in_fid_ary))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We really have to get the post ids first!
|
||||||
|
$sql = 'SELECT topic_first_post_id, topic_time
|
||||||
|
FROM ' . TOPICS_TABLE . '
|
||||||
|
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
|
||||||
|
AND topic_moved_id = 0
|
||||||
|
AND topic_approved = 1
|
||||||
|
ORDER BY topic_time DESC';
|
||||||
|
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||||
|
|
||||||
|
$post_ids = array();
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$post_ids[] = (int) $row['topic_first_post_id'];
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($post_ids))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sql = array(
|
||||||
|
'SELECT' => 'f.forum_id, f.forum_name,
|
||||||
|
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time,
|
||||||
|
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
|
||||||
|
'FROM' => array(
|
||||||
|
TOPICS_TABLE => 't',
|
||||||
|
POSTS_TABLE => 'p',
|
||||||
|
),
|
||||||
|
'LEFT_JOIN' => array(
|
||||||
|
array(
|
||||||
|
'FROM' => array(FORUMS_TABLE => 'f'),
|
||||||
|
'ON' => 'p.forum_id = f.forum_id',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'WHERE' => 'p.topic_id = t.topic_id
|
||||||
|
AND ' . $this->db->sql_in_set('p.post_id', $post_ids),
|
||||||
|
'ORDER_BY' => 'p.post_time DESC',
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function adjust_item(&$item_row, &$row)
|
||||||
|
{
|
||||||
|
parent::adjust_item($item_row, $row);
|
||||||
|
|
||||||
|
$item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title'];
|
||||||
|
}
|
||||||
|
}
|
136
phpBB/includes/feed/topics_active.php
Normal file
136
phpBB/includes/feed/topics_active.php
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active Topics feed
|
||||||
|
*
|
||||||
|
* This will give you the last {$this->num_items} topics
|
||||||
|
* with replies made withing the last {$this->sort_days} days
|
||||||
|
* including the last post.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_feed_topics_active extends phpbb_feed_topic_base
|
||||||
|
{
|
||||||
|
var $sort_days = 7;
|
||||||
|
|
||||||
|
function set_keys()
|
||||||
|
{
|
||||||
|
parent::set_keys();
|
||||||
|
|
||||||
|
$this->set('author_id', 'topic_last_poster_id');
|
||||||
|
$this->set('creator', 'topic_last_poster_name');
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sql()
|
||||||
|
{
|
||||||
|
$forum_ids_read = $this->get_readable_forums();
|
||||||
|
if (empty($forum_ids_read))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$in_fid_ary = array_intersect($forum_ids_read, $this->get_forum_ids());
|
||||||
|
$in_fid_ary = array_diff($in_fid_ary, $this->get_passworded_forums());
|
||||||
|
if (empty($in_fid_ary))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search for topics in last X days
|
||||||
|
$last_post_time_sql = ($this->sort_days) ? ' AND topic_last_post_time > ' . (time() - ($this->sort_days * 24 * 3600)) : '';
|
||||||
|
|
||||||
|
// We really have to get the post ids first!
|
||||||
|
$sql = 'SELECT topic_last_post_id, topic_last_post_time
|
||||||
|
FROM ' . TOPICS_TABLE . '
|
||||||
|
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
|
||||||
|
AND topic_moved_id = 0
|
||||||
|
AND topic_approved = 1
|
||||||
|
' . $last_post_time_sql . '
|
||||||
|
ORDER BY topic_last_post_time DESC';
|
||||||
|
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||||
|
|
||||||
|
$post_ids = array();
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$post_ids[] = (int) $row['topic_last_post_id'];
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($post_ids))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sql = array(
|
||||||
|
'SELECT' => 'f.forum_id, f.forum_name,
|
||||||
|
t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_views,
|
||||||
|
t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time,
|
||||||
|
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
|
||||||
|
'FROM' => array(
|
||||||
|
TOPICS_TABLE => 't',
|
||||||
|
POSTS_TABLE => 'p',
|
||||||
|
),
|
||||||
|
'LEFT_JOIN' => array(
|
||||||
|
array(
|
||||||
|
'FROM' => array(FORUMS_TABLE => 'f'),
|
||||||
|
'ON' => 'p.forum_id = f.forum_id',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'WHERE' => 'p.topic_id = t.topic_id
|
||||||
|
AND ' . $this->db->sql_in_set('p.post_id', $post_ids),
|
||||||
|
'ORDER_BY' => 'p.post_time DESC',
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_forum_ids()
|
||||||
|
{
|
||||||
|
static $forum_ids;
|
||||||
|
|
||||||
|
$cache_name = 'feed_topic_active_forum_ids';
|
||||||
|
|
||||||
|
if (!isset($forum_ids) && ($forum_ids = $this->cache->get('_' . $cache_name)) === false)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT forum_id
|
||||||
|
FROM ' . FORUMS_TABLE . '
|
||||||
|
WHERE forum_type = ' . FORUM_POST . '
|
||||||
|
AND ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_EXCLUDE, '= 0') . '
|
||||||
|
AND ' . $this->db->sql_bit_and('forum_flags', log(FORUM_FLAG_ACTIVE_TOPICS, 2), '<> 0');
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
|
$forum_ids = array();
|
||||||
|
while ($forum_id = (int) $this->db->sql_fetchfield('forum_id'))
|
||||||
|
{
|
||||||
|
$forum_ids[$forum_id] = $forum_id;
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$this->cache->put('_' . $cache_name, $forum_ids, 180);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $forum_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
function adjust_item(&$item_row, &$row)
|
||||||
|
{
|
||||||
|
parent::adjust_item($item_row, $row);
|
||||||
|
|
||||||
|
$item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title'];
|
||||||
|
}
|
||||||
|
}
|
|
@ -846,7 +846,7 @@ function phpbb_is_writable($file)
|
||||||
*/
|
*/
|
||||||
function phpbb_is_absolute($path)
|
function phpbb_is_absolute($path)
|
||||||
{
|
{
|
||||||
return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:[/\\\]#i', $path))) ? true : false;
|
return (isset($path[0]) && $path[0] == '/' || preg_match('#^[a-z]:[/\\\]#i', $path)) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2907,7 +2907,7 @@ function meta_refresh($time, $url, $disable_cd_check = false)
|
||||||
|
|
||||||
// For XHTML compatibility we change back & to &
|
// For XHTML compatibility we change back & to &
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'META' => '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />')
|
'META' => '<meta http-equiv="refresh" content="' . $time . '; url=' . $url . '" />')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3467,6 +3467,7 @@ function login_forum_box($forum_data)
|
||||||
page_header($user->lang['LOGIN'], false);
|
page_header($user->lang['LOGIN'], false);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
'FORUM_NAME' => isset($forum_data['forum_name']) ? $forum_data['forum_name'] : '',
|
||||||
'S_LOGIN_ACTION' => build_url(array('f')),
|
'S_LOGIN_ACTION' => build_url(array('f')),
|
||||||
'S_HIDDEN_FIELDS' => build_hidden_fields(array('f' => $forum_data['forum_id'])))
|
'S_HIDDEN_FIELDS' => build_hidden_fields(array('f' => $forum_data['forum_id'])))
|
||||||
);
|
);
|
||||||
|
|
|
@ -249,17 +249,49 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||||
{
|
{
|
||||||
case 'text':
|
case 'text':
|
||||||
case 'password':
|
case 'password':
|
||||||
|
case 'url':
|
||||||
|
case 'email':
|
||||||
|
case 'color':
|
||||||
|
case 'date':
|
||||||
|
case 'time':
|
||||||
|
case 'datetime':
|
||||||
|
case 'datetime-local':
|
||||||
|
case 'month':
|
||||||
|
case 'range':
|
||||||
|
case 'search':
|
||||||
|
case 'tel':
|
||||||
|
case 'url':
|
||||||
|
case 'week':
|
||||||
$size = (int) $tpl_type[1];
|
$size = (int) $tpl_type[1];
|
||||||
$maxlength = (int) $tpl_type[2];
|
$maxlength = (int) $tpl_type[2];
|
||||||
|
|
||||||
$tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />';
|
$tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'dimension':
|
case 'number':
|
||||||
$size = (int) $tpl_type[1];
|
$min = $max = $maxlength = '';
|
||||||
$maxlength = (int) $tpl_type[2];
|
$min = ( isset($tpl_type[1]) ) ? (int) $tpl_type[1] : false;
|
||||||
|
if ( isset($tpl_type[2]) )
|
||||||
|
{
|
||||||
|
$max = (int) $tpl_type[2];
|
||||||
|
$maxlength = strlen( (string) $max );
|
||||||
|
}
|
||||||
|
|
||||||
$tpl = '<input id="' . $key . '" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" /> x <input type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" />';
|
$tpl = '<input id="' . $key . '" type="number" maxlength="' . (( $maxlength != '' ) ? $maxlength : 255) . '"' . (( $min != '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="' . $name . '" value="' . $new[$config_key] . '" />';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'dimension':
|
||||||
|
$min = $max = $maxlength = $size = '';
|
||||||
|
|
||||||
|
$min = (int) $tpl_type[1];
|
||||||
|
|
||||||
|
if ( isset($tpl_type[2]) )
|
||||||
|
{
|
||||||
|
$max = (int) $tpl_type[2];
|
||||||
|
$size = $maxlength = strlen( (string) $max );
|
||||||
|
}
|
||||||
|
|
||||||
|
$tpl = '<input id="' . $key . '" type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" /> x <input type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" />';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
|
|
|
@ -3040,38 +3040,29 @@ function tidy_database()
|
||||||
*/
|
*/
|
||||||
function add_permission_language()
|
function add_permission_language()
|
||||||
{
|
{
|
||||||
global $user, $phpEx;
|
global $user, $phpEx, $phpbb_extension_manager;
|
||||||
|
|
||||||
// First of all, our own file. We need to include it as the first file because it presets all relevant variables.
|
// add permission language files from extensions
|
||||||
$user->add_lang('acp/permissions_phpbb');
|
$finder = $phpbb_extension_manager->get_finder();
|
||||||
|
|
||||||
$files_to_add = array();
|
$lang_files = $finder
|
||||||
|
->prefix('permissions_')
|
||||||
|
->suffix(".$phpEx")
|
||||||
|
->core_path('language/' . $user->lang_name . '/')
|
||||||
|
->extension_directory('/language/' . $user->lang_name)
|
||||||
|
->find();
|
||||||
|
|
||||||
// Now search in acp and mods folder for permissions_ files.
|
foreach ($lang_files as $lang_file => $ext_name)
|
||||||
foreach (array('acp/', 'mods/') as $path)
|
|
||||||
{
|
{
|
||||||
$dh = @opendir($user->lang_path . $user->lang_name . '/' . $path);
|
if ($ext_name === '/')
|
||||||
|
|
||||||
if ($dh)
|
|
||||||
{
|
{
|
||||||
while (($file = readdir($dh)) !== false)
|
$user->add_lang($lang_file);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if ($file !== 'permissions_phpbb.' . $phpEx && strpos($file, 'permissions_') === 0 && substr($file, -(strlen($phpEx) + 1)) === '.' . $phpEx)
|
$user->add_lang_ext($ext_name, $lang_file);
|
||||||
{
|
|
||||||
$files_to_add[] = $path . substr($file, 0, -(strlen($phpEx) + 1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($dh);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sizeof($files_to_add))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$user->add_lang($files_to_add);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3097,7 +3088,7 @@ function obtain_latest_version_info($force_update = false, $warn_fail = false, $
|
||||||
$info = get_remote_file('version.phpbb.com', '/phpbb',
|
$info = get_remote_file('version.phpbb.com', '/phpbb',
|
||||||
((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno);
|
((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno);
|
||||||
|
|
||||||
if ($info === false)
|
if (empty($info))
|
||||||
{
|
{
|
||||||
$cache->destroy('versioncheck');
|
$cache->destroy('versioncheck');
|
||||||
if ($warn_fail)
|
if ($warn_fail)
|
||||||
|
|
|
@ -625,7 +625,7 @@ function phpbb_increment_downloads($db, $ids)
|
||||||
*/
|
*/
|
||||||
function phpbb_download_handle_forum_auth($db, $auth, $topic_id)
|
function phpbb_download_handle_forum_auth($db, $auth, $topic_id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT t.forum_id, f.forum_password, f.parent_id
|
$sql = 'SELECT t.forum_id, f.forum_name, f.forum_password, f.parent_id
|
||||||
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
|
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
|
||||||
WHERE t.topic_id = " . (int) $topic_id . "
|
WHERE t.topic_id = " . (int) $topic_id . "
|
||||||
AND t.forum_id = f.forum_id";
|
AND t.forum_id = f.forum_id";
|
||||||
|
|
|
@ -403,14 +403,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
|
||||||
$upload->set_disallowed_content(explode('|', $config['mime_triggers']));
|
$upload->set_disallowed_content(explode('|', $config['mime_triggers']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$local)
|
$filedata['post_attach'] = $local || $upload->is_valid($form_name);
|
||||||
{
|
|
||||||
$filedata['post_attach'] = ($upload->is_valid($form_name)) ? true : false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$filedata['post_attach'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$filedata['post_attach'])
|
if (!$filedata['post_attach'])
|
||||||
{
|
{
|
||||||
|
@ -429,30 +422,18 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
|
||||||
return $filedata;
|
return $filedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cat_id = (isset($extensions[$file->get('extension')]['display_cat'])) ? $extensions[$file->get('extension')]['display_cat'] : ATTACHMENT_CATEGORY_NONE;
|
// Whether the uploaded file is in the image category
|
||||||
|
$is_image = (isset($extensions[$file->get('extension')]['display_cat'])) ? $extensions[$file->get('extension')]['display_cat'] == ATTACHMENT_CATEGORY_IMAGE : false;
|
||||||
|
|
||||||
// Make sure the image category only holds valid images...
|
if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id))
|
||||||
if ($cat_id == ATTACHMENT_CATEGORY_IMAGE && !$file->is_image())
|
|
||||||
{
|
{
|
||||||
$file->remove();
|
|
||||||
|
|
||||||
// If this error occurs a user tried to exploit an IE Bug by renaming extensions
|
|
||||||
// Since the image category is displaying content inline we need to catch this.
|
|
||||||
trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do we have to create a thumbnail?
|
|
||||||
$filedata['thumbnail'] = ($cat_id == ATTACHMENT_CATEGORY_IMAGE && $config['img_create_thumbnail']) ? 1 : 0;
|
|
||||||
|
|
||||||
// Check Image Size, if it is an image
|
// Check Image Size, if it is an image
|
||||||
if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id) && $cat_id == ATTACHMENT_CATEGORY_IMAGE)
|
if ($is_image)
|
||||||
{
|
{
|
||||||
$file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']);
|
$file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Admins and mods are allowed to exceed the allowed filesize
|
// Admins and mods are allowed to exceed the allowed filesize
|
||||||
if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id))
|
|
||||||
{
|
|
||||||
if (!empty($extensions[$file->get('extension')]['max_filesize']))
|
if (!empty($extensions[$file->get('extension')]['max_filesize']))
|
||||||
{
|
{
|
||||||
$allowed_filesize = $extensions[$file->get('extension')]['max_filesize'];
|
$allowed_filesize = $extensions[$file->get('extension')]['max_filesize'];
|
||||||
|
@ -467,10 +448,12 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
|
||||||
|
|
||||||
$file->clean_filename('unique', $user->data['user_id'] . '_');
|
$file->clean_filename('unique', $user->data['user_id'] . '_');
|
||||||
|
|
||||||
// Are we uploading an image *and* this image being within the image category? Only then perform additional image checks.
|
// Are we uploading an image *and* this image being within the image category?
|
||||||
$no_image = ($cat_id == ATTACHMENT_CATEGORY_IMAGE) ? false : true;
|
// Only then perform additional image checks.
|
||||||
|
$file->move_file($config['upload_path'], false, !$is_image);
|
||||||
|
|
||||||
$file->move_file($config['upload_path'], false, $no_image);
|
// Do we have to create a thumbnail?
|
||||||
|
$filedata['thumbnail'] = ($is_image && $config['img_create_thumbnail']) ? 1 : 0;
|
||||||
|
|
||||||
if (sizeof($file->error))
|
if (sizeof($file->error))
|
||||||
{
|
{
|
||||||
|
@ -481,6 +464,16 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
|
||||||
return $filedata;
|
return $filedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the image category only holds valid images...
|
||||||
|
if ($is_image && !$file->is_image())
|
||||||
|
{
|
||||||
|
$file->remove();
|
||||||
|
|
||||||
|
// If this error occurs a user tried to exploit an IE Bug by renaming extensions
|
||||||
|
// Since the image category is displaying content inline we need to catch this.
|
||||||
|
trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']);
|
||||||
|
}
|
||||||
|
|
||||||
$filedata['filesize'] = $file->get('filesize');
|
$filedata['filesize'] = $file->get('filesize');
|
||||||
$filedata['mimetype'] = $file->get('mimetype');
|
$filedata['mimetype'] = $file->get('mimetype');
|
||||||
$filedata['extension'] = $file->get('extension');
|
$filedata['extension'] = $file->get('extension');
|
||||||
|
|
|
@ -1040,9 +1040,9 @@ class custom_profile_admin extends custom_profile
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'),
|
0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'),
|
||||||
1 => array('TITLE' => $user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'),
|
1 => array('TITLE' => $user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'),
|
||||||
2 => array('TITLE' => $user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'),
|
2 => array('TITLE' => $user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" size="5" value="' . $this->vars['field_maxlen'] . '" />'),
|
||||||
3 => array('TITLE' => $user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>')
|
3 => array('TITLE' => $user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1057,9 +1057,9 @@ class custom_profile_admin extends custom_profile
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input name="rows" size="5" value="' . $this->vars['rows'] . '" /> ' . $user->lang['ROWS'] . '</dd><dd><input name="columns" size="5" value="' . $this->vars['columns'] . '" /> ' . $user->lang['COLUMNS'] . ' <input type="hidden" name="field_length" value="' . $this->vars['field_length'] . '" />'),
|
0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="rows" size="5" value="' . $this->vars['rows'] . '" /> ' . $user->lang['ROWS'] . '</dd><dd><input type="number" min="0" max="99999" name="columns" size="5" value="' . $this->vars['columns'] . '" /> ' . $user->lang['COLUMNS'] . ' <input type="hidden" name="field_length" value="' . $this->vars['field_length'] . '" />'),
|
||||||
1 => array('TITLE' => $user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_minlen" size="10" value="' . $this->vars['field_minlen'] . '" />'),
|
1 => array('TITLE' => $user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="9999999999" name="field_minlen" size="10" value="' . $this->vars['field_minlen'] . '" />'),
|
||||||
2 => array('TITLE' => $user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="text" name="field_maxlen" size="10" value="' . $this->vars['field_maxlen'] . '" />'),
|
2 => array('TITLE' => $user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="9999999999" name="field_maxlen" size="10" value="' . $this->vars['field_maxlen'] . '" />'),
|
||||||
3 => array('TITLE' => $user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>')
|
3 => array('TITLE' => $user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1074,9 +1074,9 @@ class custom_profile_admin extends custom_profile
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'),
|
0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'),
|
||||||
1 => array('TITLE' => $user->lang['MIN_FIELD_NUMBER'], 'FIELD' => '<input type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'),
|
1 => array('TITLE' => $user->lang['MIN_FIELD_NUMBER'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'),
|
||||||
2 => array('TITLE' => $user->lang['MAX_FIELD_NUMBER'], 'FIELD' => '<input type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'),
|
2 => array('TITLE' => $user->lang['MAX_FIELD_NUMBER'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'),
|
||||||
3 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => '<input type="post" name="field_default_value" value="' . $this->vars['field_default_value'] . '" />')
|
3 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => '<input type="post" name="field_default_value" value="' . $this->vars['field_default_value'] . '" />')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1330,24 +1330,14 @@ function validate_data($data, $val_ary)
|
||||||
{
|
{
|
||||||
$function = array_shift($validate);
|
$function = array_shift($validate);
|
||||||
array_unshift($validate, $data[$var]);
|
array_unshift($validate, $data[$var]);
|
||||||
|
$function_prefix = (function_exists('phpbb_validate_' . $function)) ? 'phpbb_validate_' : 'validate_';
|
||||||
|
|
||||||
if (function_exists('phpbb_validate_' . $function))
|
if ($result = call_user_func_array($function_prefix . $function, $validate))
|
||||||
{
|
|
||||||
if ($result = call_user_func_array('phpbb_validate_' . $function, $validate))
|
|
||||||
{
|
{
|
||||||
// Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted.
|
// Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted.
|
||||||
$error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var);
|
$error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($result = call_user_func_array('validate_' . $function, $validate))
|
|
||||||
{
|
|
||||||
// Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted.
|
|
||||||
$error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $error;
|
return $error;
|
||||||
|
@ -2008,6 +1998,30 @@ function validate_jabber($jid)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate hex colour value
|
||||||
|
*
|
||||||
|
* @param string $colour The hex colour value
|
||||||
|
* @param bool $optional Whether the colour value is optional. True if an empty
|
||||||
|
* string will be accepted as correct input, false if not.
|
||||||
|
* @return bool|string Error message if colour value is incorrect, false if it
|
||||||
|
* fits the hex colour code
|
||||||
|
*/
|
||||||
|
function phpbb_validate_hex_colour($colour, $optional = false)
|
||||||
|
{
|
||||||
|
if ($colour === '')
|
||||||
|
{
|
||||||
|
return (($optional) ? false : 'WRONG_DATA');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', $colour))
|
||||||
|
{
|
||||||
|
return 'WRONG_DATA';
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies whether a style ID corresponds to an active style.
|
* Verifies whether a style ID corresponds to an active style.
|
||||||
*
|
*
|
||||||
|
|
|
@ -116,6 +116,17 @@ class phpbb_lock_db
|
||||||
return $this->locked;
|
return $this->locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this process own the lock?
|
||||||
|
*
|
||||||
|
* @return bool true if lock is owned
|
||||||
|
* false otherwise
|
||||||
|
*/
|
||||||
|
public function owns_lock()
|
||||||
|
{
|
||||||
|
return (bool) $this->locked;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases the lock.
|
* Releases the lock.
|
||||||
*
|
*
|
||||||
|
|
|
@ -110,6 +110,17 @@ class phpbb_lock_flock
|
||||||
return (bool) $this->lock_fp;
|
return (bool) $this->lock_fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does this process own the lock?
|
||||||
|
*
|
||||||
|
* @return bool true if lock is owned
|
||||||
|
* false otherwise
|
||||||
|
*/
|
||||||
|
public function owns_lock()
|
||||||
|
{
|
||||||
|
return (bool) $this->lock_fp;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases the lock.
|
* Releases the lock.
|
||||||
*
|
*
|
||||||
|
|
29
phpBB/includes/notification/exception.php
Normal file
29
phpBB/includes/notification/exception.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package notifications
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifications exception
|
||||||
|
*
|
||||||
|
* @package notifications
|
||||||
|
*/
|
||||||
|
class phpbb_notification_exception extends \Exception
|
||||||
|
{
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->getMessage();
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,6 +36,9 @@ class phpbb_notification_manager
|
||||||
/** @var phpbb_db_driver */
|
/** @var phpbb_db_driver */
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
|
/** @var phpbb_cache_service */
|
||||||
|
protected $cache;
|
||||||
|
|
||||||
/** @var phpbb_user */
|
/** @var phpbb_user */
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ class phpbb_notification_manager
|
||||||
* @param string $user_notifications_table
|
* @param string $user_notifications_table
|
||||||
* @return phpbb_notification_manager
|
* @return phpbb_notification_manager
|
||||||
*/
|
*/
|
||||||
public function __construct($notification_types, $notification_methods, $phpbb_container, phpbb_user_loader $user_loader, phpbb_db_driver $db, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
|
public function __construct($notification_types, $notification_methods, $phpbb_container, phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
|
||||||
{
|
{
|
||||||
$this->notification_types = $notification_types;
|
$this->notification_types = $notification_types;
|
||||||
$this->notification_methods = $notification_methods;
|
$this->notification_methods = $notification_methods;
|
||||||
|
@ -78,6 +81,7 @@ class phpbb_notification_manager
|
||||||
|
|
||||||
$this->user_loader = $user_loader;
|
$this->user_loader = $user_loader;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
$this->cache = $cache;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
@ -145,7 +149,7 @@ class phpbb_notification_manager
|
||||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||||
WHERE n.user_id = ' . (int) $options['user_id'] . '
|
WHERE n.user_id = ' . (int) $options['user_id'] . '
|
||||||
AND n.notification_read = 0
|
AND n.notification_read = 0
|
||||||
AND nt.notification_type = n.item_type
|
AND nt.notification_type_id = n.notification_type_id
|
||||||
AND nt.notification_type_enabled = 1';
|
AND nt.notification_type_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$unread_count = (int) $this->db->sql_fetchfield('unread_count', $result);
|
$unread_count = (int) $this->db->sql_fetchfield('unread_count', $result);
|
||||||
|
@ -158,7 +162,7 @@ class phpbb_notification_manager
|
||||||
$sql = 'SELECT COUNT(n.notification_id) AS total_count
|
$sql = 'SELECT COUNT(n.notification_id) AS total_count
|
||||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||||
WHERE n.user_id = ' . (int) $options['user_id'] . '
|
WHERE n.user_id = ' . (int) $options['user_id'] . '
|
||||||
AND nt.notification_type = n.item_type
|
AND nt.notification_type_id = n.notification_type_id
|
||||||
AND nt.notification_type_enabled = 1';
|
AND nt.notification_type_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$total_count = (int) $this->db->sql_fetchfield('total_count', $result);
|
$total_count = (int) $this->db->sql_fetchfield('total_count', $result);
|
||||||
|
@ -170,11 +174,11 @@ class phpbb_notification_manager
|
||||||
$rowset = array();
|
$rowset = array();
|
||||||
|
|
||||||
// Get the main notifications
|
// Get the main notifications
|
||||||
$sql = 'SELECT n.*
|
$sql = 'SELECT n.*, nt.notification_type_name
|
||||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||||
WHERE n.user_id = ' . (int) $options['user_id'] .
|
WHERE n.user_id = ' . (int) $options['user_id'] .
|
||||||
(($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('n.notification_id', $options['notification_id']) : ' AND n.notification_id = ' . (int) $options['notification_id']) : '') . '
|
(($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('n.notification_id', $options['notification_id']) : ' AND n.notification_id = ' . (int) $options['notification_id']) : '') . '
|
||||||
AND nt.notification_type = n.item_type
|
AND nt.notification_type_id = n.notification_type_id
|
||||||
AND nt.notification_type_enabled = 1
|
AND nt.notification_type_enabled = 1
|
||||||
ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
|
ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
|
||||||
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
|
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
|
||||||
|
@ -188,12 +192,12 @@ class phpbb_notification_manager
|
||||||
// Get all unread notifications
|
// Get all unread notifications
|
||||||
if ($unread_count && $options['all_unread'] && !empty($rowset))
|
if ($unread_count && $options['all_unread'] && !empty($rowset))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT n.*
|
$sql = 'SELECT n.*, nt.notification_type_name
|
||||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||||
WHERE n.user_id = ' . (int) $options['user_id'] . '
|
WHERE n.user_id = ' . (int) $options['user_id'] . '
|
||||||
AND n.notification_read = 0
|
AND n.notification_read = 0
|
||||||
AND ' . $this->db->sql_in_set('n.notification_id', array_keys($rowset), true) . '
|
AND ' . $this->db->sql_in_set('n.notification_id', array_keys($rowset), true) . '
|
||||||
AND nt.notification_type = n.item_type
|
AND nt.notification_type_id = n.notification_type_id
|
||||||
AND nt.notification_type_enabled = 1
|
AND nt.notification_type_enabled = 1
|
||||||
ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
|
ORDER BY n.' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
|
||||||
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
|
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
|
||||||
|
@ -207,17 +211,17 @@ class phpbb_notification_manager
|
||||||
|
|
||||||
foreach ($rowset as $row)
|
foreach ($rowset as $row)
|
||||||
{
|
{
|
||||||
$notification = $this->get_item_type_class($row['item_type'], $row);
|
$notification = $this->get_item_type_class($row['notification_type_name'], $row);
|
||||||
|
|
||||||
// Array of user_ids to query all at once
|
// Array of user_ids to query all at once
|
||||||
$user_ids = array_merge($user_ids, $notification->users_to_query());
|
$user_ids = array_merge($user_ids, $notification->users_to_query());
|
||||||
|
|
||||||
// Some notification types also require querying additional tables themselves
|
// Some notification types also require querying additional tables themselves
|
||||||
if (!isset($load_special[$row['item_type']]))
|
if (!isset($load_special[$row['notification_type_name']]))
|
||||||
{
|
{
|
||||||
$load_special[$row['item_type']] = array();
|
$load_special[$row['notification_type_name']] = array();
|
||||||
}
|
}
|
||||||
$load_special[$row['item_type']] = array_merge($load_special[$row['item_type']], $notification->get_load_special());
|
$load_special[$row['notification_type_name']] = array_merge($load_special[$row['notification_type_name']], $notification->get_load_special());
|
||||||
|
|
||||||
$notifications[$row['notification_id']] = $notification;
|
$notifications[$row['notification_id']] = $notification;
|
||||||
}
|
}
|
||||||
|
@ -243,19 +247,21 @@ class phpbb_notification_manager
|
||||||
/**
|
/**
|
||||||
* Mark notifications read
|
* Mark notifications read
|
||||||
*
|
*
|
||||||
* @param bool|string|array $item_type Type identifier or array of item types (only acceptable if the $data is identical for the specified types). False to mark read for all item types
|
* @param bool|string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types). False to mark read for all item types
|
||||||
* @param bool|int|array $item_id Item id or array of item ids. False to mark read for all item ids
|
* @param bool|int|array $item_id Item id or array of item ids. False to mark read for all item ids
|
||||||
* @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids
|
* @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids
|
||||||
* @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False)
|
* @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False)
|
||||||
*/
|
*/
|
||||||
public function mark_notifications_read($item_type, $item_id, $user_id, $time = false)
|
public function mark_notifications_read($notification_type_name, $item_id, $user_id, $time = false)
|
||||||
{
|
{
|
||||||
$time = ($time !== false) ? $time : time();
|
$time = ($time !== false) ? $time : time();
|
||||||
|
|
||||||
$sql = 'UPDATE ' . $this->notifications_table . "
|
$sql = 'UPDATE ' . $this->notifications_table . "
|
||||||
SET notification_read = 1
|
SET notification_read = 1
|
||||||
WHERE notification_time <= " . (int) $time .
|
WHERE notification_time <= " . (int) $time .
|
||||||
(($item_type !== false) ? ' AND ' . (is_array($item_type) ? $this->db->sql_in_set('item_type', $item_type) : " item_type = '" . $this->db->sql_escape($item_type) . "'") : '') .
|
(($notification_type_name !== false) ? ' AND ' .
|
||||||
|
(is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name))
|
||||||
|
: '') .
|
||||||
(($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '') .
|
(($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '') .
|
||||||
(($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : '');
|
(($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : '');
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
@ -264,29 +270,21 @@ class phpbb_notification_manager
|
||||||
/**
|
/**
|
||||||
* Mark notifications read from a parent identifier
|
* Mark notifications read from a parent identifier
|
||||||
*
|
*
|
||||||
* @param string|array $item_type Type identifier or array of item types (only acceptable if the $data is identical for the specified types)
|
* @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types)
|
||||||
* @param bool|int|array $item_parent_id Item parent id or array of item parent ids. False to mark read for all item parent ids
|
* @param bool|int|array $item_parent_id Item parent id or array of item parent ids. False to mark read for all item parent ids
|
||||||
* @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids
|
* @param bool|int|array $user_id User id or array of user ids. False to mark read for all user ids
|
||||||
* @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False)
|
* @param bool|int $time Time at which to mark all notifications prior to as read. False to mark all as read. (Default: False)
|
||||||
*/
|
*/
|
||||||
public function mark_notifications_read_by_parent($item_type, $item_parent_id, $user_id, $time = false)
|
public function mark_notifications_read_by_parent($notification_type_name, $item_parent_id, $user_id, $time = false)
|
||||||
{
|
{
|
||||||
if (is_array($item_type))
|
|
||||||
{
|
|
||||||
foreach ($item_type as $type)
|
|
||||||
{
|
|
||||||
$this->mark_notifications_read_by_parent($type, $item_parent_id, $user_id, $time);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$time = ($time !== false) ? $time : time();
|
$time = ($time !== false) ? $time : time();
|
||||||
|
|
||||||
$sql = 'UPDATE ' . $this->notifications_table . "
|
$sql = 'UPDATE ' . $this->notifications_table . "
|
||||||
SET notification_read = 1
|
SET notification_read = 1
|
||||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
WHERE notification_time <= " . (int) $time .
|
||||||
AND notification_time <= " . (int) $time .
|
(($notification_type_name !== false) ? ' AND ' .
|
||||||
|
(is_array($notification_type_name) ? $this->db->sql_in_set('notification_type_id', $this->get_notification_type_ids($notification_type_name)) : 'notification_type_id = ' . $this->get_notification_type_id($notification_type_name))
|
||||||
|
: '') .
|
||||||
(($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id) : 'item_parent_id = ' . (int) $item_parent_id) : '') .
|
(($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id) : 'item_parent_id = ' . (int) $item_parent_id) : '') .
|
||||||
(($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '');
|
(($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '');
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
@ -312,7 +310,7 @@ class phpbb_notification_manager
|
||||||
/**
|
/**
|
||||||
* Add a notification
|
* Add a notification
|
||||||
*
|
*
|
||||||
* @param string|array $item_type Type identifier or array of item types (only acceptable if the $data is identical for the specified types)
|
* @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types)
|
||||||
* Note: If you send an array of types, any user who could receive multiple notifications from this single item will only receive
|
* Note: If you send an array of types, any user who could receive multiple notifications from this single item will only receive
|
||||||
* a single notification. If they MUST receive multiple notifications, call this function multiple times instead of sending an array
|
* a single notification. If they MUST receive multiple notifications, call this function multiple times instead of sending an array
|
||||||
* @param array $data Data specific for this type that will be inserted
|
* @param array $data Data specific for this type that will be inserted
|
||||||
|
@ -320,18 +318,18 @@ class phpbb_notification_manager
|
||||||
* ignore_users array of data to specify which users should not receive certain types of notifications
|
* ignore_users array of data to specify which users should not receive certain types of notifications
|
||||||
* @return array Information about what users were notified and how they were notified
|
* @return array Information about what users were notified and how they were notified
|
||||||
*/
|
*/
|
||||||
public function add_notifications($item_type, $data, array $options = array())
|
public function add_notifications($notification_type_name, $data, array $options = array())
|
||||||
{
|
{
|
||||||
$options = array_merge(array(
|
$options = array_merge(array(
|
||||||
'ignore_users' => array(),
|
'ignore_users' => array(),
|
||||||
), $options);
|
), $options);
|
||||||
|
|
||||||
if (is_array($item_type))
|
if (is_array($notification_type_name))
|
||||||
{
|
{
|
||||||
$notified_users = array();
|
$notified_users = array();
|
||||||
$temp_options = $options;
|
$temp_options = $options;
|
||||||
|
|
||||||
foreach ($item_type as $type)
|
foreach ($notification_type_name as $type)
|
||||||
{
|
{
|
||||||
$temp_options['ignore_users'] = $options['ignore_users'] + $notified_users;
|
$temp_options['ignore_users'] = $options['ignore_users'] + $notified_users;
|
||||||
$notified_users += $this->add_notifications($type, $data, $temp_options);
|
$notified_users += $this->add_notifications($type, $data, $temp_options);
|
||||||
|
@ -340,12 +338,12 @@ class phpbb_notification_manager
|
||||||
return $notified_users;
|
return $notified_users;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_id = $this->get_item_type_class($item_type)->get_item_id($data);
|
$item_id = $this->get_item_type_class($notification_type_name)->get_item_id($data);
|
||||||
|
|
||||||
// find out which users want to receive this type of notification
|
// find out which users want to receive this type of notification
|
||||||
$notify_users = $this->get_item_type_class($item_type)->find_users_for_notification($data, $options);
|
$notify_users = $this->get_item_type_class($notification_type_name)->find_users_for_notification($data, $options);
|
||||||
|
|
||||||
$this->add_notifications_for_users($item_type, $data, $notify_users);
|
$this->add_notifications_for_users($notification_type_name, $data, $notify_users);
|
||||||
|
|
||||||
return $notify_users;
|
return $notify_users;
|
||||||
}
|
}
|
||||||
|
@ -353,15 +351,15 @@ class phpbb_notification_manager
|
||||||
/**
|
/**
|
||||||
* Add a notification for specific users
|
* Add a notification for specific users
|
||||||
*
|
*
|
||||||
* @param string|array $item_type Type identifier or array of item types (only acceptable if the $data is identical for the specified types)
|
* @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types)
|
||||||
* @param array $data Data specific for this type that will be inserted
|
* @param array $data Data specific for this type that will be inserted
|
||||||
* @param array $notify_users User list to notify
|
* @param array $notify_users User list to notify
|
||||||
*/
|
*/
|
||||||
public function add_notifications_for_users($item_type, $data, $notify_users)
|
public function add_notifications_for_users($notification_type_name, $data, $notify_users)
|
||||||
{
|
{
|
||||||
if (is_array($item_type))
|
if (is_array($notification_type_name))
|
||||||
{
|
{
|
||||||
foreach ($item_type as $type)
|
foreach ($notification_type_name as $type)
|
||||||
{
|
{
|
||||||
$this->add_notifications_for_users($type, $data, $notify_users);
|
$this->add_notifications_for_users($type, $data, $notify_users);
|
||||||
}
|
}
|
||||||
|
@ -369,24 +367,9 @@ class phpbb_notification_manager
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT notification_type
|
$notification_type_id = $this->get_notification_type_id($notification_type_name);
|
||||||
FROM ' . $this->notification_types_table . "
|
|
||||||
WHERE notification_type = '" . $this->db->sql_escape($item_type) . "'";
|
|
||||||
$result = $this->db->sql_query($sql);
|
|
||||||
|
|
||||||
if ($this->db->sql_fetchrow($result) === false)
|
$item_id = $this->get_item_type_class($notification_type_name)->get_item_id($data);
|
||||||
{
|
|
||||||
// Does not exist in the database, must add the item type
|
|
||||||
$sql = 'INSERT INTO ' . $this->notification_types_table . ' ' . $this->db->sql_build_array('INSERT', array(
|
|
||||||
'notification_type' => $item_type,
|
|
||||||
'notification_type_enabled' => 1,
|
|
||||||
));
|
|
||||||
$this->db->sql_query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$item_id = $this->get_item_type_class($item_type)->get_item_id($data);
|
|
||||||
|
|
||||||
$user_ids = array();
|
$user_ids = array();
|
||||||
$notification_objects = $notification_methods = array();
|
$notification_objects = $notification_methods = array();
|
||||||
|
@ -397,10 +380,10 @@ class phpbb_notification_manager
|
||||||
// Make sure not to send new notifications to users who've already been notified about this item
|
// Make sure not to send new notifications to users who've already been notified about this item
|
||||||
// This may happen when an item was added, but now new users are able to see the item
|
// This may happen when an item was added, but now new users are able to see the item
|
||||||
$sql = 'SELECT n.user_id
|
$sql = 'SELECT n.user_id
|
||||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
|
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||||
WHERE n.item_type = '" . $this->db->sql_escape($item_type) . "'
|
WHERE n.notification_type_id = ' . (int) $notification_type_id . '
|
||||||
AND n.item_id = " . (int) $item_id . '
|
AND n.item_id = ' . (int) $item_id . '
|
||||||
AND nt.notification_type = n.item_type
|
AND nt.notification_type_id = n.notification_type_id
|
||||||
AND nt.notification_type_enabled = 1';
|
AND nt.notification_type_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
@ -415,7 +398,7 @@ class phpbb_notification_manager
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow notifications to perform actions before creating the insert array (such as run a query to cache some data needed for all notifications)
|
// Allow notifications to perform actions before creating the insert array (such as run a query to cache some data needed for all notifications)
|
||||||
$notification = $this->get_item_type_class($item_type);
|
$notification = $this->get_item_type_class($notification_type_name);
|
||||||
$pre_create_data = $notification->pre_create_insert_array($data, $notify_users);
|
$pre_create_data = $notification->pre_create_insert_array($data, $notify_users);
|
||||||
unset($notification);
|
unset($notification);
|
||||||
|
|
||||||
|
@ -424,7 +407,7 @@ class phpbb_notification_manager
|
||||||
// Go through each user so we can insert a row in the DB and then notify them by their desired means
|
// Go through each user so we can insert a row in the DB and then notify them by their desired means
|
||||||
foreach ($notify_users as $user => $methods)
|
foreach ($notify_users as $user => $methods)
|
||||||
{
|
{
|
||||||
$notification = $this->get_item_type_class($item_type);
|
$notification = $this->get_item_type_class($notification_type_name);
|
||||||
|
|
||||||
$notification->user_id = (int) $user;
|
$notification->user_id = (int) $user;
|
||||||
|
|
||||||
|
@ -464,14 +447,14 @@ class phpbb_notification_manager
|
||||||
/**
|
/**
|
||||||
* Update a notification
|
* Update a notification
|
||||||
*
|
*
|
||||||
* @param string|array $item_type Type identifier or array of item types (only acceptable if the $data is identical for the specified types)
|
* @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types)
|
||||||
* @param array $data Data specific for this type that will be updated
|
* @param array $data Data specific for this type that will be updated
|
||||||
*/
|
*/
|
||||||
public function update_notifications($item_type, $data)
|
public function update_notifications($notification_type_name, $data)
|
||||||
{
|
{
|
||||||
if (is_array($item_type))
|
if (is_array($notification_type_name))
|
||||||
{
|
{
|
||||||
foreach ($item_type as $type)
|
foreach ($notification_type_name as $type)
|
||||||
{
|
{
|
||||||
$this->update_notifications($type, $data);
|
$this->update_notifications($type, $data);
|
||||||
}
|
}
|
||||||
|
@ -479,7 +462,7 @@ class phpbb_notification_manager
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$notification = $this->get_item_type_class($item_type);
|
$notification = $this->get_item_type_class($notification_type_name);
|
||||||
|
|
||||||
// Allow the notifications class to over-ride the update_notifications functionality
|
// Allow the notifications class to over-ride the update_notifications functionality
|
||||||
if (method_exists($notification, 'update_notifications'))
|
if (method_exists($notification, 'update_notifications'))
|
||||||
|
@ -491,28 +474,29 @@ class phpbb_notification_manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$notification_type_id = $this->get_notification_type_id($notification_type_name);
|
||||||
$item_id = $notification->get_item_id($data);
|
$item_id = $notification->get_item_id($data);
|
||||||
$update_array = $notification->create_update_array($data);
|
$update_array = $notification->create_update_array($data);
|
||||||
|
|
||||||
$sql = 'UPDATE ' . $this->notifications_table . '
|
$sql = 'UPDATE ' . $this->notifications_table . '
|
||||||
SET ' . $this->db->sql_build_array('UPDATE', $update_array) . "
|
SET ' . $this->db->sql_build_array('UPDATE', $update_array) . '
|
||||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
WHERE notification_type_id = ' . (int) $notification_type_id . '
|
||||||
AND item_id = " . (int) $item_id;
|
AND item_id = ' . (int) $item_id;
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a notification
|
* Delete a notification
|
||||||
*
|
*
|
||||||
* @param string|array $item_type Type identifier or array of item types (only acceptable if the $item_id is identical for the specified types)
|
* @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $item_id is identical for the specified types)
|
||||||
* @param int|array $item_id Identifier within the type (or array of ids)
|
* @param int|array $item_id Identifier within the type (or array of ids)
|
||||||
* @param array $data Data specific for this type that will be updated
|
* @param array $data Data specific for this type that will be updated
|
||||||
*/
|
*/
|
||||||
public function delete_notifications($item_type, $item_id)
|
public function delete_notifications($notification_type_name, $item_id)
|
||||||
{
|
{
|
||||||
if (is_array($item_type))
|
if (is_array($notification_type_name))
|
||||||
{
|
{
|
||||||
foreach ($item_type as $type)
|
foreach ($notification_type_name as $type)
|
||||||
{
|
{
|
||||||
$this->delete_notifications($type, $item_id);
|
$this->delete_notifications($type, $item_id);
|
||||||
}
|
}
|
||||||
|
@ -520,9 +504,11 @@ class phpbb_notification_manager
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . $this->notifications_table . "
|
$notification_type_id = $this->get_notification_type_id($notification_type_name);
|
||||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
|
||||||
AND " . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id);
|
$sql = 'DELETE FROM ' . $this->notifications_table . '
|
||||||
|
WHERE notification_type_id = ' . (int) $notification_type_id . '
|
||||||
|
AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id);
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +641,8 @@ class phpbb_notification_manager
|
||||||
{
|
{
|
||||||
if ($method !== '')
|
if ($method !== '')
|
||||||
{
|
{
|
||||||
$this->add_subscription($item_type, $item_type, '', $user_id);
|
// Make sure to subscribe them to the base subscription
|
||||||
|
$this->add_subscription($item_type, $item_id, '', $user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id;
|
$user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id;
|
||||||
|
@ -755,13 +742,13 @@ class phpbb_notification_manager
|
||||||
* is disabled so that all those notifications are hidden and do not
|
* is disabled so that all those notifications are hidden and do not
|
||||||
* cause errors
|
* cause errors
|
||||||
*
|
*
|
||||||
* @param string $item_type Type identifier of the subscription
|
* @param string $notification_type_name Type identifier of the subscription
|
||||||
*/
|
*/
|
||||||
public function disable_notifications($item_type)
|
public function disable_notifications($notification_type_name)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . $this->notification_types_table . "
|
$sql = 'UPDATE ' . $this->notification_types_table . "
|
||||||
SET notification_type_enabled = 0
|
SET notification_type_enabled = 0
|
||||||
WHERE notification_type = '" . $this->db->sql_escape($item_type) . "'";
|
WHERE notification_type_name = '" . $this->db->sql_escape($notification_type_name) . "'";
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,17 +758,21 @@ class phpbb_notification_manager
|
||||||
* This should be called when an extension which has notification types
|
* This should be called when an extension which has notification types
|
||||||
* is purged so that all those notifications are removed
|
* is purged so that all those notifications are removed
|
||||||
*
|
*
|
||||||
* @param string $item_type Type identifier of the subscription
|
* @param string $notification_type_name Type identifier of the subscription
|
||||||
*/
|
*/
|
||||||
public function purge_notifications($item_type)
|
public function purge_notifications($notification_type_name)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM ' . $this->notifications_table . "
|
$notification_type_id = $this->get_notification_type_id($notification_type_name);
|
||||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'";
|
|
||||||
|
$sql = 'DELETE FROM ' . $this->notifications_table . '
|
||||||
|
WHERE notification_type_id = ' . (int) $notification_type_id;
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . $this->notification_types_table . "
|
$sql = 'DELETE FROM ' . $this->notification_types_table . '
|
||||||
WHERE notification_type = '" . $this->db->sql_escape($item_type) . "'";
|
WHERE notification_type_id = ' . (int) $notification_type_id;
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
$this->cache->destroy('notification_type_ids');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -791,13 +782,13 @@ class phpbb_notification_manager
|
||||||
* that was disabled is re-enabled so that all those notifications that
|
* that was disabled is re-enabled so that all those notifications that
|
||||||
* were hidden are shown again
|
* were hidden are shown again
|
||||||
*
|
*
|
||||||
* @param string $item_type Type identifier of the subscription
|
* @param string $notification_type_name Type identifier of the subscription
|
||||||
*/
|
*/
|
||||||
public function enable_notifications($item_type)
|
public function enable_notifications($notification_type_name)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . $this->notification_types_table . "
|
$sql = 'UPDATE ' . $this->notification_types_table . "
|
||||||
SET notification_type_enabled = 1
|
SET notification_type_enabled = 1
|
||||||
WHERE notification_type = '" . $this->db->sql_escape($item_type) . "'";
|
WHERE notification_type_name = '" . $this->db->sql_escape($notification_type_name) . "'";
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,11 +807,11 @@ class phpbb_notification_manager
|
||||||
/**
|
/**
|
||||||
* Helper to get the notifications item type class and set it up
|
* Helper to get the notifications item type class and set it up
|
||||||
*/
|
*/
|
||||||
public function get_item_type_class($item_type, $data = array())
|
public function get_item_type_class($notification_type_name, $data = array())
|
||||||
{
|
{
|
||||||
$item_type = (strpos($item_type, 'notification.type.') === 0) ? $item_type : 'notification.type.' . $item_type;
|
$notification_type_name = (strpos($notification_type_name, 'notification.type.') === 0) ? $notification_type_name : 'notification.type.' . $notification_type_name;
|
||||||
|
|
||||||
$item = $this->load_object($item_type);
|
$item = $this->load_object($notification_type_name);
|
||||||
|
|
||||||
$item->set_initial_data($data);
|
$item->set_initial_data($data);
|
||||||
|
|
||||||
|
@ -851,4 +842,69 @@ class phpbb_notification_manager
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification type id from the name
|
||||||
|
*
|
||||||
|
* @param string $notification_type_name The name
|
||||||
|
* @return int the notification_type_id
|
||||||
|
*/
|
||||||
|
public function get_notification_type_id($notification_type_name)
|
||||||
|
{
|
||||||
|
$notification_type_ids = $this->cache->get('notification_type_ids');
|
||||||
|
|
||||||
|
if ($notification_type_ids === false)
|
||||||
|
{
|
||||||
|
$notification_type_ids = array();
|
||||||
|
|
||||||
|
$sql = 'SELECT notification_type_id, notification_type_name
|
||||||
|
FROM ' . $this->notification_types_table;
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$notification_type_ids[$row['notification_type_name']] = (int) $row['notification_type_id'];
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$this->cache->put('notification_type_ids', $notification_type_ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($notification_type_ids[$notification_type_name]))
|
||||||
|
{
|
||||||
|
if (!isset($this->notification_types[$notification_type_name]) && !isset($this->notification_types['notification.type.' . $notification_type_name]))
|
||||||
|
{
|
||||||
|
throw new phpbb_notification_exception($this->user->lang('NOTIFICATION_TYPE_NOT_EXIST', $notification_type_name));
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO ' . $this->notification_types_table . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||||
|
'notification_type_name' => $notification_type_name,
|
||||||
|
'notification_type_enabled' => 1,
|
||||||
|
));
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
$notification_type_ids[$notification_type_name] = (int) $this->db->sql_nextid();
|
||||||
|
|
||||||
|
$this->cache->put('notification_type_ids', $notification_type_ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $notification_type_ids[$notification_type_name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get notification type ids (as an array)
|
||||||
|
*
|
||||||
|
* @param array $notification_type_names Array of strings
|
||||||
|
* @return array Array of integers
|
||||||
|
*/
|
||||||
|
public function get_notification_type_ids(array $notification_type_names)
|
||||||
|
{
|
||||||
|
$notification_type_ids = array();
|
||||||
|
|
||||||
|
foreach ($notification_type_names as $name)
|
||||||
|
{
|
||||||
|
$notification_type_ids[$name] = $this->get_notification_type_id($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $notification_type_ids;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth
|
||||||
/** @var phpbb_db_driver */
|
/** @var phpbb_db_driver */
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
/** @var phpbb_cache_service */
|
/** @var phpbb_cache_driver_interface */
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
/** @var phpbb_template */
|
/** @var phpbb_template */
|
||||||
|
|
|
@ -39,7 +39,7 @@ class phpbb_notification_method_email extends phpbb_notification_method_messenge
|
||||||
*/
|
*/
|
||||||
public function is_available()
|
public function is_available()
|
||||||
{
|
{
|
||||||
return (bool) $this->config['email_enable'];
|
return $this->config['email_enable'] && $this->user->data['user_email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,7 +30,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||||
/** @var phpbb_db_driver */
|
/** @var phpbb_db_driver */
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
/** @var phpbb_cache_service */
|
/** @var phpbb_cache_driver_interface */
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
/** @var phpbb_template */
|
/** @var phpbb_template */
|
||||||
|
@ -68,9 +68,17 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||||
*/
|
*/
|
||||||
public static $notification_option = false;
|
public static $notification_option = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The notification_type_id, set upon creation of the class
|
||||||
|
* This is the notification_type_id from the notification_types table
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $notification_type_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indentification data
|
* Indentification data
|
||||||
* item_type - Type of the item (translates to the notification type)
|
* notification_type_id - ID of the item type (auto generated, from notification types table)
|
||||||
* item_id - ID of the item (e.g. post_id, msg_id)
|
* item_id - ID of the item (e.g. post_id, msg_id)
|
||||||
* item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc)
|
* item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc)
|
||||||
* user_id
|
* user_id
|
||||||
|
@ -124,6 +132,8 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||||
public function set_notification_manager(phpbb_notification_manager $notification_manager)
|
public function set_notification_manager(phpbb_notification_manager $notification_manager)
|
||||||
{
|
{
|
||||||
$this->notification_manager = $notification_manager;
|
$this->notification_manager = $notification_manager;
|
||||||
|
|
||||||
|
$this->notification_type_id = $this->notification_manager->get_notification_type_id($this->get_type());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -211,7 +221,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||||
// Defaults
|
// Defaults
|
||||||
$this->data = array_merge(array(
|
$this->data = array_merge(array(
|
||||||
'item_id' => static::get_item_id($type_data),
|
'item_id' => static::get_item_id($type_data),
|
||||||
'item_type' => $this->get_type(),
|
'notification_type_id' => $this->notification_type_id,
|
||||||
'item_parent_id' => static::get_item_parent_id($type_data),
|
'item_parent_id' => static::get_item_parent_id($type_data),
|
||||||
|
|
||||||
'notification_time' => time(),
|
'notification_time' => time(),
|
||||||
|
@ -460,7 +470,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||||
$this->notification_read = (bool) !$unread;
|
$this->notification_read = (bool) !$unread;
|
||||||
|
|
||||||
$where = array(
|
$where = array(
|
||||||
"item_type = '" . $this->db->sql_escape($this->item_type) . "'",
|
'notification_type_id = ' . (int) $this->notification_type_id,
|
||||||
'item_id = ' . (int) $this->item_id,
|
'item_id = ' . (int) $this->item_id,
|
||||||
'user_id = ' . (int) $this->user_id,
|
'user_id = ' . (int) $this->user_id,
|
||||||
);
|
);
|
||||||
|
|
|
@ -103,11 +103,11 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post
|
||||||
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
|
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
|
||||||
$update_notifications = array();
|
$update_notifications = array();
|
||||||
$sql = 'SELECT n.*
|
$sql = 'SELECT n.*
|
||||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
|
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||||
WHERE n.item_type = '" . $this->get_type() . "'
|
WHERE n.notification_type_id = ' . (int) $this->notification_type_id . '
|
||||||
AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
AND n.item_parent_id = ' . (int) self::get_item_parent_id($post) . '
|
||||||
AND n.notification_read = 0
|
AND n.notification_read = 0
|
||||||
AND nt.notification_type = n.item_type
|
AND nt.notification_type_id = n.notification_type_id
|
||||||
AND nt.notification_type_enabled = 1';
|
AND nt.notification_type_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
|
|
@ -138,11 +138,11 @@ class phpbb_notification_type_post extends phpbb_notification_type_base
|
||||||
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
|
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
|
||||||
$update_notifications = array();
|
$update_notifications = array();
|
||||||
$sql = 'SELECT n.*
|
$sql = 'SELECT n.*
|
||||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
|
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||||
WHERE n.item_type = '" . $this->get_type() . "'
|
WHERE n.notification_type_id = ' . (int) $this->notification_type_id . '
|
||||||
AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
AND n.item_parent_id = ' . (int) self::get_item_parent_id($post) . '
|
||||||
AND n.notification_read = 0
|
AND n.notification_read = 0
|
||||||
AND nt.notification_type = n.item_type
|
AND nt.notification_type_id = n.notification_type_id
|
||||||
AND nt.notification_type_enabled = 1';
|
AND nt.notification_type_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
|
|
@ -122,11 +122,11 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
|
||||||
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
|
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
|
||||||
$update_notifications = array();
|
$update_notifications = array();
|
||||||
$sql = 'SELECT n.*
|
$sql = 'SELECT n.*
|
||||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
|
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||||
WHERE n.item_type = '" . $this->get_type() . "'
|
WHERE n.notification_type_id = ' . (int) $this->notification_type_id . '
|
||||||
AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
AND n.item_parent_id = ' . (int) self::get_item_parent_id($post) . '
|
||||||
AND n.notification_read = 0
|
AND n.notification_read = 0
|
||||||
AND nt.notification_type = n.item_type
|
AND nt.notification_type_id = n.notification_type_id
|
||||||
AND nt.notification_type_enabled = 1';
|
AND nt.notification_type_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
@ -154,10 +154,10 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
|
||||||
{
|
{
|
||||||
$old_notifications = array();
|
$old_notifications = array();
|
||||||
$sql = 'SELECT n.user_id
|
$sql = 'SELECT n.user_id
|
||||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
|
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||||
WHERE n.item_type = '" . $this->get_type() . "'
|
WHERE n.notification_type_id = ' . (int) $this->notification_type_id . '
|
||||||
AND n.item_id = " . self::get_item_id($post) . '
|
AND n.item_id = ' . self::get_item_id($post) . '
|
||||||
AND nt.notification_type = n.item_type
|
AND nt.notification_type_id = n.notification_type_id
|
||||||
AND nt.notification_type_enabled = 1';
|
AND nt.notification_type_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
@ -185,9 +185,9 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
|
||||||
// Remove the necessary notifications
|
// Remove the necessary notifications
|
||||||
if (!empty($remove_notifications))
|
if (!empty($remove_notifications))
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM ' . $this->notifications_table . "
|
$sql = 'DELETE FROM ' . $this->notifications_table . '
|
||||||
WHERE item_type = '" . $this->get_type() . "'
|
WHERE notification_type_id = ' . (int) $this->notification_type_id . '
|
||||||
AND item_id = " . self::get_item_id($post) . '
|
AND item_id = ' . self::get_item_id($post) . '
|
||||||
AND ' . $this->db->sql_in_set('user_id', $remove_notifications);
|
AND ' . $this->db->sql_in_set('user_id', $remove_notifications);
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,9 +163,16 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
|
||||||
$engine = $info['Type'];
|
$engine = $info['Type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($engine != 'MyISAM')
|
$fulltext_supported =
|
||||||
|
$engine === 'MyISAM' ||
|
||||||
|
// FULLTEXT is supported on InnoDB since MySQL 5.6.4 according to
|
||||||
|
// http://dev.mysql.com/doc/refman/5.6/en/innodb-storage-engine.html
|
||||||
|
$engine === 'InnoDB' &&
|
||||||
|
phpbb_version_compare($this->db->sql_server_info(true), '5.6.4', '>=');
|
||||||
|
|
||||||
|
if (!$fulltext_supported)
|
||||||
{
|
{
|
||||||
return $this->user->lang['FULLTEXT_MYSQL_NOT_MYISAM'];
|
return $this->user->lang['FULLTEXT_MYSQL_NOT_SUPPORTED'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SHOW VARIABLES
|
$sql = 'SHOW VARIABLES
|
||||||
|
|
|
@ -1819,11 +1819,11 @@ class phpbb_search_fulltext_native extends phpbb_search_base
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="fulltext_native_min_chars">' . $this->user->lang['MIN_SEARCH_CHARS'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['MIN_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
|
<dt><label for="fulltext_native_min_chars">' . $this->user->lang['MIN_SEARCH_CHARS'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['MIN_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
|
||||||
<dd><input id="fulltext_native_min_chars" type="text" size="3" maxlength="3" name="config[fulltext_native_min_chars]" value="' . (int) $this->config['fulltext_native_min_chars'] . '" /></dd>
|
<dd><input id="fulltext_native_min_chars" type="number" size="3" maxlength="3" min="0" max="255" name="config[fulltext_native_min_chars]" value="' . (int) $this->config['fulltext_native_min_chars'] . '" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="fulltext_native_max_chars">' . $this->user->lang['MAX_SEARCH_CHARS'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['MAX_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
|
<dt><label for="fulltext_native_max_chars">' . $this->user->lang['MAX_SEARCH_CHARS'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['MAX_SEARCH_CHARS_EXPLAIN'] . '</span></dt>
|
||||||
<dd><input id="fulltext_native_max_chars" type="text" size="3" maxlength="3" name="config[fulltext_native_max_chars]" value="' . (int) $this->config['fulltext_native_max_chars'] . '" /></dd>
|
<dd><input id="fulltext_native_max_chars" type="number" size="3" maxlength="3" min="0" max="255" name="config[fulltext_native_max_chars]" value="' . (int) $this->config['fulltext_native_max_chars'] . '" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="fulltext_native_common_thres">' . $this->user->lang['COMMON_WORD_THRESHOLD'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['COMMON_WORD_THRESHOLD_EXPLAIN'] . '</span></dt>
|
<dt><label for="fulltext_native_common_thres">' . $this->user->lang['COMMON_WORD_THRESHOLD'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['COMMON_WORD_THRESHOLD_EXPLAIN'] . '</span></dt>
|
||||||
|
|
|
@ -214,7 +214,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||||
{
|
{
|
||||||
if ($terms == 'all')
|
if ($terms == 'all')
|
||||||
{
|
{
|
||||||
$match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#');
|
$match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#');
|
||||||
$replace = array(' +', ' |', ' -', ' +', ' -', ' |');
|
$replace = array(' +', ' |', ' -', ' +', ' -', ' |');
|
||||||
|
|
||||||
$keywords = preg_replace($match, $replace, $keywords);
|
$keywords = preg_replace($match, $replace, $keywords);
|
||||||
|
@ -970,11 +970,11 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="fulltext_postgres_min_word_len">' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN_EXPLAIN'] . '</span></dt>
|
<dt><label for="fulltext_postgres_min_word_len">' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN_EXPLAIN'] . '</span></dt>
|
||||||
<dd><input id="fulltext_postgres_min_word_len" type="text" size="3" maxlength="3" name="config[fulltext_postgres_min_word_len]" value="' . (int) $this->config['fulltext_postgres_min_word_len'] . '" /></dd>
|
<dd><input id="fulltext_postgres_min_word_len" type="number" size="3" maxlength="3" min="0" max="255" name="config[fulltext_postgres_min_word_len]" value="' . (int) $this->config['fulltext_postgres_min_word_len'] . '" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="fulltext_postgres_max_word_len">' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN_EXPLAIN'] . '</span></dt>
|
<dt><label for="fulltext_postgres_max_word_len">' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN_EXPLAIN'] . '</span></dt>
|
||||||
<dd><input id="fulltext_postgres_max_word_len" type="text" size="3" maxlength="3" name="config[fulltext_postgres_max_word_len]" value="' . (int) $this->config['fulltext_postgres_max_word_len'] . '" /></dd>
|
<dd><input id="fulltext_postgres_max_word_len" type="number" size="3" maxlength="3" min="0" max="255" name="config[fulltext_postgres_max_word_len]" value="' . (int) $this->config['fulltext_postgres_max_word_len'] . '" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|
|
@ -888,11 +888,11 @@ class phpbb_search_fulltext_sphinx
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="fulltext_sphinx_port">' . $this->user->lang['FULLTEXT_SPHINX_PORT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_PORT_EXPLAIN'] . '</span></dt>
|
<dt><label for="fulltext_sphinx_port">' . $this->user->lang['FULLTEXT_SPHINX_PORT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_PORT_EXPLAIN'] . '</span></dt>
|
||||||
<dd><input id="fulltext_sphinx_port" type="text" size="4" maxlength="10" name="config[fulltext_sphinx_port]" value="' . $this->config['fulltext_sphinx_port'] . '" /></dd>
|
<dd><input id="fulltext_sphinx_port" type="number" size="4" maxlength="10" name="config[fulltext_sphinx_port]" value="' . $this->config['fulltext_sphinx_port'] . '" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="fulltext_sphinx_indexer_mem_limit">' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '</span></dt>
|
<dt><label for="fulltext_sphinx_indexer_mem_limit">' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '</span></dt>
|
||||||
<dd><input id="fulltext_sphinx_indexer_mem_limit" type="text" size="4" maxlength="10" name="config[fulltext_sphinx_indexer_mem_limit]" value="' . $this->config['fulltext_sphinx_indexer_mem_limit'] . '" /> ' . $this->user->lang['MIB'] . '</dd>
|
<dd><input id="fulltext_sphinx_indexer_mem_limit" type="number" size="4" maxlength="10" name="config[fulltext_sphinx_indexer_mem_limit]" value="' . $this->config['fulltext_sphinx_indexer_mem_limit'] . '" /> ' . $this->user->lang['MIB'] . '</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="fulltext_sphinx_config_file">' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '</span></dt>
|
<dt><label for="fulltext_sphinx_config_file">' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '</span></dt>
|
||||||
|
|
|
@ -32,6 +32,13 @@ class phpbb_template_compile
|
||||||
*/
|
*/
|
||||||
private $filter_params;
|
private $filter_params;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of default parameters
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $default_filter_params;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
@ -44,7 +51,7 @@ class phpbb_template_compile
|
||||||
*/
|
*/
|
||||||
public function __construct($allow_php, $style_names, $locator, $phpbb_root_path, $extension_manager = null, $user = null)
|
public function __construct($allow_php, $style_names, $locator, $phpbb_root_path, $extension_manager = null, $user = null)
|
||||||
{
|
{
|
||||||
$this->filter_params = array(
|
$this->filter_params = $this->default_filter_params = array(
|
||||||
'allow_php' => $allow_php,
|
'allow_php' => $allow_php,
|
||||||
'style_names' => $style_names,
|
'style_names' => $style_names,
|
||||||
'locator' => $locator,
|
'locator' => $locator,
|
||||||
|
@ -52,9 +59,31 @@ class phpbb_template_compile
|
||||||
'extension_manager' => $extension_manager,
|
'extension_manager' => $extension_manager,
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'template_compile' => $this,
|
'template_compile' => $this,
|
||||||
|
'cleanup' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set filter parameters
|
||||||
|
*
|
||||||
|
* @param array $params Array of parameters (will be merged onto $this->filter_params)
|
||||||
|
*/
|
||||||
|
public function set_filter_params($params)
|
||||||
|
{
|
||||||
|
$this->filter_params = array_merge(
|
||||||
|
$this->filter_params,
|
||||||
|
$params
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset filter parameters to their default settings
|
||||||
|
*/
|
||||||
|
public function reset_filter_params()
|
||||||
|
{
|
||||||
|
$this->filter_params = $this->default_filter_params;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiles template in $source_file and writes compiled template to
|
* Compiles template in $source_file and writes compiled template to
|
||||||
* cache directory
|
* cache directory
|
||||||
|
|
|
@ -75,6 +75,14 @@ class phpbb_template_filter extends php_user_filter
|
||||||
*/
|
*/
|
||||||
private $allow_php;
|
private $allow_php;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether cleanup will be performed on resulting code, see compile()
|
||||||
|
* (Preserve whitespace)
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $cleanup = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resource locator.
|
* Resource locator.
|
||||||
*
|
*
|
||||||
|
@ -183,6 +191,7 @@ class phpbb_template_filter extends php_user_filter
|
||||||
$this->phpbb_root_path = $this->params['phpbb_root_path'];
|
$this->phpbb_root_path = $this->params['phpbb_root_path'];
|
||||||
$this->style_names = $this->params['style_names'];
|
$this->style_names = $this->params['style_names'];
|
||||||
$this->extension_manager = $this->params['extension_manager'];
|
$this->extension_manager = $this->params['extension_manager'];
|
||||||
|
$this->cleanup = $this->params['cleanup'];
|
||||||
if (isset($this->params['user']))
|
if (isset($this->params['user']))
|
||||||
{
|
{
|
||||||
$this->user = $this->params['user'];
|
$this->user = $this->params['user'];
|
||||||
|
@ -223,9 +232,16 @@ class phpbb_template_filter extends php_user_filter
|
||||||
$data = preg_replace('~<!-- ENDPHP -->.*?$~', '', $data);
|
$data = preg_replace('~<!-- ENDPHP -->.*?$~', '', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->cleanup)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Preserve whitespace.
|
Preserve whitespace.
|
||||||
PHP removes a newline after the closing tag (if it's there). This is by design.
|
PHP removes a newline after the closing tag (if it's there).
|
||||||
|
This is by design:
|
||||||
|
|
||||||
|
http://www.php.net/manual/en/language.basic-syntax.phpmode.php
|
||||||
|
http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php
|
||||||
|
|
||||||
|
|
||||||
Consider the following template:
|
Consider the following template:
|
||||||
|
@ -234,24 +250,27 @@ class phpbb_template_filter extends php_user_filter
|
||||||
some content
|
some content
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
If we were to simply preserve all whitespace, we could simply replace all "?>" tags
|
If we were to simply preserve all whitespace, we could simply
|
||||||
with "?>\n".
|
replace all "?>" tags with "?>\n".
|
||||||
Doing that, would add additional newlines to the compiled tempalte in place of the
|
Doing that, would add additional newlines to the compiled
|
||||||
IF and ENDIF statements. These newlines are unwanted (and one is conditional).
|
template in place of the IF and ENDIF statements. These
|
||||||
The IF and ENDIF are usually on their own line for ease of reading.
|
newlines are unwanted (and one is conditional). The IF and
|
||||||
|
ENDIF are usually on their own line for ease of reading.
|
||||||
|
|
||||||
This replacement preserves newlines only for statements that aren't the only statement on a line.
|
This replacement preserves newlines only for statements that
|
||||||
It will NOT preserve newlines at the end of statements in the above examle.
|
are not the only statement on a line. It will NOT preserve
|
||||||
|
newlines at the end of statements in the above example.
|
||||||
It will preserve newlines in situations like:
|
It will preserve newlines in situations like:
|
||||||
|
|
||||||
<!-- IF condition -->inline content<!-- ENDIF -->
|
<!-- IF condition -->inline content<!-- ENDIF -->
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$data = preg_replace('~(?<!^)(<\?php.+(?<!/\*\*/)\?>)$~m', "$1\n", $data);
|
$data = preg_replace('~(?<!^)(<\?php.+(?<!/\*\*/)\?>)$~m', "$1\n", $data);
|
||||||
$data = str_replace('/**/?>', "?>\n", $data);
|
$data = str_replace('/**/?>', "?>\n", $data);
|
||||||
$data = str_replace('?><?php', '', $data);
|
$data = str_replace('?><?php', '', $data);
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,6 +348,10 @@ class phpbb_template_filter extends php_user_filter
|
||||||
return '<?php ' . $this->compile_tag_define($matches[2], false) . ' ?>';
|
return '<?php ' . $this->compile_tag_define($matches[2], false) . ' ?>';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'ENDDEFINE':
|
||||||
|
return '<?php ' . $this->compile_tag_enddefine() . ' ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'INCLUDE':
|
case 'INCLUDE':
|
||||||
return '<?php ' . $this->compile_tag_include($matches[2]) . ' ?>';
|
return '<?php ' . $this->compile_tag_include($matches[2]) . ' ?>';
|
||||||
break;
|
break;
|
||||||
|
@ -833,6 +856,16 @@ class phpbb_template_filter extends php_user_filter
|
||||||
$match = array();
|
$match = array();
|
||||||
preg_match('#^((?:' . self::REGEX_NS . '\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (.*?))?$#', $tag_args, $match);
|
preg_match('#^((?:' . self::REGEX_NS . '\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (.*?))?$#', $tag_args, $match);
|
||||||
|
|
||||||
|
if (!empty($match[2]) && !isset($match[3]) && $op)
|
||||||
|
{
|
||||||
|
// DEFINE tag with ENDDEFINE
|
||||||
|
$array = "\$_tpldata['DEFINE']['.vars']";
|
||||||
|
$code = 'ob_start(); ';
|
||||||
|
$code .= "if (!isset($array)) { $array = array(); } ";
|
||||||
|
$code .= "{$array}[] = '{$match[2]}'";
|
||||||
|
return $code;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($match[2]) || (!isset($match[3]) && $op))
|
if (empty($match[2]) || (!isset($match[3]) && $op))
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
|
@ -859,6 +892,20 @@ class phpbb_template_filter extends php_user_filter
|
||||||
return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $parsed_statement . ';';
|
return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $parsed_statement . ';';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile ENDDEFINE tag
|
||||||
|
*
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function compile_tag_enddefine()
|
||||||
|
{
|
||||||
|
$array = "\$_tpldata['DEFINE']['.vars']";
|
||||||
|
$code = "if (!isset($array) || !sizeof($array)) { trigger_error('ENDDEFINE tag without DEFINE in ' . basename(__FILE__), E_USER_ERROR); }";
|
||||||
|
$code .= "\$define_var = array_pop($array); ";
|
||||||
|
$code .= "\$_tpldata['DEFINE']['.'][\$define_var] = ob_get_clean();";
|
||||||
|
return $code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile INCLUDE tag
|
* Compile INCLUDE tag
|
||||||
*
|
*
|
||||||
|
@ -961,8 +1008,14 @@ class phpbb_template_filter extends php_user_filter
|
||||||
$all_compiled = '';
|
$all_compiled = '';
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
|
$this->template_compile->set_filter_params(array(
|
||||||
|
'cleanup' => false,
|
||||||
|
));
|
||||||
|
|
||||||
$compiled = $this->template_compile->compile_file($file);
|
$compiled = $this->template_compile->compile_file($file);
|
||||||
|
|
||||||
|
$this->template_compile->reset_filter_params();
|
||||||
|
|
||||||
if ($compiled === false)
|
if ($compiled === false)
|
||||||
{
|
{
|
||||||
if ($this->user)
|
if ($this->user)
|
||||||
|
|
122
phpBB/includes/tree/interface.php
Normal file
122
phpBB/includes/tree/interface.php
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package tree
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface phpbb_tree_interface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Inserts an item into the database table and into the tree.
|
||||||
|
*
|
||||||
|
* @param array $item The item to be added
|
||||||
|
* @return array Array with item data as set in the database
|
||||||
|
*/
|
||||||
|
public function insert(array $additional_data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an item from the tree and from the database table
|
||||||
|
*
|
||||||
|
* Also deletes the subtree from the tree and from the database table
|
||||||
|
*
|
||||||
|
* @param int $item_id The item to be deleted
|
||||||
|
* @return array Item ids that have been deleted
|
||||||
|
*/
|
||||||
|
public function delete($item_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move an item by a given delta
|
||||||
|
*
|
||||||
|
* An item is only moved up/down within the same parent. If the delta is
|
||||||
|
* larger then the number of children, the item is moved to the top/bottom
|
||||||
|
* of the list of children within this parent.
|
||||||
|
*
|
||||||
|
* @param int $item_id The item to be moved
|
||||||
|
* @param int $delta Number of steps to move this item, < 0 => down, > 0 => up
|
||||||
|
* @return bool True if the item was moved
|
||||||
|
*/
|
||||||
|
public function move($item_id, $delta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move an item down by 1
|
||||||
|
*
|
||||||
|
* @param int $item_id The item to be moved
|
||||||
|
* @return bool True if the item was moved
|
||||||
|
*/
|
||||||
|
public function move_down($item_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move an item up by 1
|
||||||
|
*
|
||||||
|
* @param int $item_id The item to be moved
|
||||||
|
* @return bool True if the item was moved
|
||||||
|
*/
|
||||||
|
public function move_up($item_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves all children of one item to another item
|
||||||
|
*
|
||||||
|
* If the new parent already has children, the new children are appended
|
||||||
|
* to the list.
|
||||||
|
*
|
||||||
|
* @param int $current_parent_id The current parent item
|
||||||
|
* @param int $new_parent_id The new parent item
|
||||||
|
* @return bool True if any items where moved
|
||||||
|
*/
|
||||||
|
public function move_children($current_parent_id, $new_parent_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change parent item
|
||||||
|
*
|
||||||
|
* Moves the item to the bottom of the new parent's list of children
|
||||||
|
*
|
||||||
|
* @param int $item_id The item to be moved
|
||||||
|
* @param int $new_parent_id The new parent item
|
||||||
|
* @return bool True if the parent was set successfully
|
||||||
|
*/
|
||||||
|
public function change_parent($item_id, $new_parent_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all items that are either ancestors or descendants of the item
|
||||||
|
*
|
||||||
|
* @param int $item_id Id of the item to retrieve the ancestors/descendants from
|
||||||
|
* @param bool $order_asc Order the items ascendingly (most outer ancestor first)
|
||||||
|
* @param bool $include_item Should the item matching the given item id be included in the list as well
|
||||||
|
* @return array Array of items (containing all columns from the item table)
|
||||||
|
* ID => Item data
|
||||||
|
*/
|
||||||
|
public function get_path_and_subtree_data($item_id, $order_asc, $include_item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all of the item's ancestors
|
||||||
|
*
|
||||||
|
* @param int $item_id Id of the item to retrieve the ancestors from
|
||||||
|
* @param bool $order_asc Order the items ascendingly (most outer ancestor first)
|
||||||
|
* @param bool $include_item Should the item matching the given item id be included in the list as well
|
||||||
|
* @return array Array of items (containing all columns from the item table)
|
||||||
|
* ID => Item data
|
||||||
|
*/
|
||||||
|
public function get_path_data($item_id, $order_asc, $include_item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all of the item's descendants
|
||||||
|
*
|
||||||
|
* @param int $item_id Id of the item to retrieve the descendants from
|
||||||
|
* @param bool $order_asc Order the items ascendingly
|
||||||
|
* @param bool $include_item Should the item matching the given item id be included in the list as well
|
||||||
|
* @return array Array of items (containing all columns from the item table)
|
||||||
|
* ID => Item data
|
||||||
|
*/
|
||||||
|
public function get_subtree_data($item_id, $order_asc, $include_item);
|
||||||
|
}
|
850
phpBB/includes/tree/nestedset.php
Normal file
850
phpBB/includes/tree/nestedset.php
Normal file
|
@ -0,0 +1,850 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package tree
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class phpbb_tree_nestedset implements phpbb_tree_interface
|
||||||
|
{
|
||||||
|
/** @var phpbb_db_driver */
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
/** @var phpbb_lock_db */
|
||||||
|
protected $lock;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $table_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix for the language keys returned by exceptions
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $message_prefix = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Column names in the table
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $column_item_id = 'item_id';
|
||||||
|
protected $column_left_id = 'left_id';
|
||||||
|
protected $column_right_id = 'right_id';
|
||||||
|
protected $column_parent_id = 'parent_id';
|
||||||
|
protected $column_item_parents = 'item_parents';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional SQL restrictions
|
||||||
|
* Allows to have multiple nested sets in one table
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $sql_where = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of item properties to be cached in the item_parents column
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $item_basic_data = array('*');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct
|
||||||
|
*
|
||||||
|
* @param phpbb_db_driver $db Database connection
|
||||||
|
* @param phpbb_lock_db $lock Lock class used to lock the table when moving forums around
|
||||||
|
* @param string $table_name Table name
|
||||||
|
* @param string $message_prefix Prefix for the messages thrown by exceptions
|
||||||
|
* @param string $sql_where Additional SQL restrictions for the queries
|
||||||
|
* @param array $item_basic_data Array with basic item data that is stored in item_parents
|
||||||
|
* @param array $columns Array with column names to overwrite
|
||||||
|
*/
|
||||||
|
public function __construct(phpbb_db_driver $db, phpbb_lock_db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array(), $columns = array())
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
$this->lock = $lock;
|
||||||
|
|
||||||
|
$this->table_name = $table_name;
|
||||||
|
$this->message_prefix = $message_prefix;
|
||||||
|
$this->sql_where = $sql_where;
|
||||||
|
$this->item_basic_data = (!empty($item_basic_data)) ? $item_basic_data : array('*');
|
||||||
|
|
||||||
|
if (!empty($columns))
|
||||||
|
{
|
||||||
|
foreach ($columns as $column => $name)
|
||||||
|
{
|
||||||
|
$column_name = 'column_' . $column;
|
||||||
|
$this->$column_name = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns additional sql where restrictions
|
||||||
|
*
|
||||||
|
* @param string $operator SQL operator that needs to be prepended to sql_where,
|
||||||
|
* if it is not empty.
|
||||||
|
* @param string $column_prefix Prefix that needs to be prepended to column names
|
||||||
|
* @return string Returns additional where statements to narrow down the tree,
|
||||||
|
* prefixed with operator and prepended column_prefix to column names
|
||||||
|
*/
|
||||||
|
public function get_sql_where($operator = 'AND', $column_prefix = '')
|
||||||
|
{
|
||||||
|
return (!$this->sql_where) ? '' : $operator . ' ' . sprintf($this->sql_where, $column_prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquires a lock on the item table
|
||||||
|
*
|
||||||
|
* @return bool True if the lock was acquired, false if it has been acquired previously
|
||||||
|
*
|
||||||
|
* @throws RuntimeException If the lock could not be acquired
|
||||||
|
*/
|
||||||
|
protected function acquire_lock()
|
||||||
|
{
|
||||||
|
if ($this->lock->owns_lock())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->lock->acquire())
|
||||||
|
{
|
||||||
|
throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE');
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function insert(array $additional_data)
|
||||||
|
{
|
||||||
|
$item_data = $this->reset_nestedset_values($additional_data);
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO ' . $this->table_name . ' ' . $this->db->sql_build_array('INSERT', $item_data);
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
$item_data[$this->column_item_id] = (int) $this->db->sql_nextid();
|
||||||
|
|
||||||
|
return array_merge($item_data, $this->add_item_to_nestedset($item_data[$this->column_item_id]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an item which already has a database row at the end of the tree
|
||||||
|
*
|
||||||
|
* @param int $item_id The item to be added
|
||||||
|
* @return array Array with updated data, if the item was added successfully
|
||||||
|
* Empty array otherwise
|
||||||
|
*/
|
||||||
|
protected function add_item_to_nestedset($item_id)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT MAX(' . $this->column_right_id . ') AS ' . $this->column_right_id . '
|
||||||
|
FROM ' . $this->table_name . '
|
||||||
|
' . $this->get_sql_where('WHERE');
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$current_max_right_id = (int) $this->db->sql_fetchfield($this->column_right_id);
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$update_item_data = array(
|
||||||
|
$this->column_parent_id => 0,
|
||||||
|
$this->column_left_id => $current_max_right_id + 1,
|
||||||
|
$this->column_right_id => $current_max_right_id + 2,
|
||||||
|
$this->column_item_parents => '',
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->db->sql_build_array('UPDATE', $update_item_data) . '
|
||||||
|
WHERE ' . $this->column_item_id . ' = ' . (int) $item_id . '
|
||||||
|
AND ' . $this->column_parent_id . ' = 0
|
||||||
|
AND ' . $this->column_left_id . ' = 0
|
||||||
|
AND ' . $this->column_right_id . ' = 0';
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
return ($this->db->sql_affectedrows() == 1) ? $update_item_data : array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an item from the tree without deleting it from the database
|
||||||
|
*
|
||||||
|
* Also removes all subitems from the tree without deleting them from the database either
|
||||||
|
*
|
||||||
|
* @param int $item_id The item to be deleted
|
||||||
|
* @return array Item ids that have been removed
|
||||||
|
*/
|
||||||
|
protected function remove_item_from_nestedset($item_id)
|
||||||
|
{
|
||||||
|
$item_id = (int) $item_id;
|
||||||
|
if (!$item_id)
|
||||||
|
{
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
|
||||||
|
}
|
||||||
|
|
||||||
|
$items = $this->get_subtree_data($item_id);
|
||||||
|
$item_ids = array_keys($items);
|
||||||
|
|
||||||
|
if (empty($items) || !isset($items[$item_id]))
|
||||||
|
{
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->remove_subset($item_ids, $items[$item_id]);
|
||||||
|
|
||||||
|
return $item_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function delete($item_id)
|
||||||
|
{
|
||||||
|
$removed_items = $this->remove_item_from_nestedset($item_id);
|
||||||
|
|
||||||
|
$sql = 'DELETE FROM ' . $this->table_name . '
|
||||||
|
WHERE ' . $this->db->sql_in_set($this->column_item_id, $removed_items) . '
|
||||||
|
' . $this->get_sql_where('AND');
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
return $removed_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function move($item_id, $delta)
|
||||||
|
{
|
||||||
|
if ($delta == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->acquire_lock();
|
||||||
|
|
||||||
|
$action = ($delta > 0) ? 'move_up' : 'move_down';
|
||||||
|
$delta = abs($delta);
|
||||||
|
|
||||||
|
// Keep $this->get_sql_where() here, to ensure we are in the right tree.
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . $this->table_name . '
|
||||||
|
WHERE ' . $this->column_item_id . ' = ' . (int) $item_id . '
|
||||||
|
' . $this->get_sql_where();
|
||||||
|
$result = $this->db->sql_query_limit($sql, $delta);
|
||||||
|
$item = $this->db->sql_fetchrow($result);
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (!$item)
|
||||||
|
{
|
||||||
|
$this->lock->release();
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch all the siblings between the item's current spot
|
||||||
|
* and where we want to move it to. If there are less than $delta
|
||||||
|
* siblings between the current spot and the target then the
|
||||||
|
* item will move as far as possible
|
||||||
|
*/
|
||||||
|
$sql = "SELECT {$this->column_item_id}, {$this->column_parent_id}, {$this->column_left_id}, {$this->column_right_id}, {$this->column_item_parents}
|
||||||
|
FROM " . $this->table_name . '
|
||||||
|
WHERE ' . $this->column_parent_id . ' = ' . (int) $item[$this->column_parent_id] . '
|
||||||
|
' . $this->get_sql_where() . '
|
||||||
|
AND ';
|
||||||
|
|
||||||
|
if ($action == 'move_up')
|
||||||
|
{
|
||||||
|
$sql .= $this->column_right_id . ' < ' . (int) $item[$this->column_right_id] . ' ORDER BY ' . $this->column_right_id . ' DESC';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql .= $this->column_left_id . ' > ' . (int) $item[$this->column_left_id] . ' ORDER BY ' . $this->column_left_id . ' ASC';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->sql_query_limit($sql, $delta);
|
||||||
|
|
||||||
|
$target = false;
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$target = $row;
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (!$target)
|
||||||
|
{
|
||||||
|
$this->lock->release();
|
||||||
|
// The item is already on top or bottom
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $left_id and $right_id define the scope of the items that are affected by the move.
|
||||||
|
* $diff_up and $diff_down are the values to substract or add to each item's left_id
|
||||||
|
* and right_id in order to move them up or down.
|
||||||
|
* $move_up_left and $move_up_right define the scope of the items that are moving
|
||||||
|
* up. Other items in the scope of ($left_id, $right_id) are considered to move down.
|
||||||
|
*/
|
||||||
|
if ($action == 'move_up')
|
||||||
|
{
|
||||||
|
$left_id = (int) $target[$this->column_left_id];
|
||||||
|
$right_id = (int) $item[$this->column_right_id];
|
||||||
|
|
||||||
|
$diff_up = (int) $item[$this->column_left_id] - (int) $target[$this->column_left_id];
|
||||||
|
$diff_down = (int) $item[$this->column_right_id] + 1 - (int) $item[$this->column_left_id];
|
||||||
|
|
||||||
|
$move_up_left = (int) $item[$this->column_left_id];
|
||||||
|
$move_up_right = (int) $item[$this->column_right_id];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$left_id = (int) $item[$this->column_left_id];
|
||||||
|
$right_id = (int) $target[$this->column_right_id];
|
||||||
|
|
||||||
|
$diff_up = (int) $item[$this->column_right_id] + 1 - (int) $item[$this->column_left_id];
|
||||||
|
$diff_down = (int) $target[$this->column_right_id] - (int) $item[$this->column_right_id];
|
||||||
|
|
||||||
|
$move_up_left = (int) $item[$this->column_right_id] + 1;
|
||||||
|
$move_up_right = (int) $target[$this->column_right_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now do the dirty job
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->column_left_id . ' = ' . $this->column_left_id . ' + CASE
|
||||||
|
WHEN ' . $this->column_left_id . " BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up}
|
||||||
|
ELSE {$diff_down}
|
||||||
|
END,
|
||||||
|
" . $this->column_right_id . ' = ' . $this->column_right_id . ' + CASE
|
||||||
|
WHEN ' . $this->column_right_id . " BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up}
|
||||||
|
ELSE {$diff_down}
|
||||||
|
END
|
||||||
|
WHERE
|
||||||
|
" . $this->column_left_id . " BETWEEN {$left_id} AND {$right_id}
|
||||||
|
AND " . $this->column_right_id . " BETWEEN {$left_id} AND {$right_id}
|
||||||
|
" . $this->get_sql_where();
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
$this->lock->release();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function move_down($item_id)
|
||||||
|
{
|
||||||
|
return $this->move($item_id, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function move_up($item_id)
|
||||||
|
{
|
||||||
|
return $this->move($item_id, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function move_children($current_parent_id, $new_parent_id)
|
||||||
|
{
|
||||||
|
$current_parent_id = (int) $current_parent_id;
|
||||||
|
$new_parent_id = (int) $new_parent_id;
|
||||||
|
|
||||||
|
if ($current_parent_id == $new_parent_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$current_parent_id)
|
||||||
|
{
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->acquire_lock();
|
||||||
|
|
||||||
|
$item_data = $this->get_subtree_data($current_parent_id);
|
||||||
|
if (!isset($item_data[$current_parent_id]))
|
||||||
|
{
|
||||||
|
$this->lock->release();
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_parent = $item_data[$current_parent_id];
|
||||||
|
unset($item_data[$current_parent_id]);
|
||||||
|
$move_items = array_keys($item_data);
|
||||||
|
|
||||||
|
if (($current_parent[$this->column_right_id] - $current_parent[$this->column_left_id]) <= 1)
|
||||||
|
{
|
||||||
|
$this->lock->release();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($new_parent_id, $move_items))
|
||||||
|
{
|
||||||
|
$this->lock->release();
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
|
||||||
|
}
|
||||||
|
|
||||||
|
$diff = sizeof($move_items) * 2;
|
||||||
|
$sql_exclude_moved_items = $this->db->sql_in_set($this->column_item_id, $move_items, true);
|
||||||
|
|
||||||
|
$this->db->sql_transaction('begin');
|
||||||
|
|
||||||
|
$this->remove_subset($move_items, $current_parent, false, true);
|
||||||
|
|
||||||
|
if ($new_parent_id)
|
||||||
|
{
|
||||||
|
// Retrieve new-parent again, it may have been changed...
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . $this->table_name . '
|
||||||
|
WHERE ' . $this->column_item_id . ' = ' . $new_parent_id;
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$new_parent = $this->db->sql_fetchrow($result);
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (!$new_parent)
|
||||||
|
{
|
||||||
|
$this->db->sql_transaction('rollback');
|
||||||
|
$this->lock->release();
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true);
|
||||||
|
|
||||||
|
if ($new_right_id > $current_parent[$this->column_right_id])
|
||||||
|
{
|
||||||
|
$diff = ' + ' . ($new_right_id - $current_parent[$this->column_right_id]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$diff = ' - ' . abs($new_right_id - $current_parent[$this->column_right_id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'SELECT MAX(' . $this->column_right_id . ') AS ' . $this->column_right_id . '
|
||||||
|
FROM ' . $this->table_name . '
|
||||||
|
WHERE ' . $sql_exclude_moved_items . '
|
||||||
|
' . $this->get_sql_where('AND');
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$row = $this->db->sql_fetchrow($result);
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$diff = ' + ' . ($row[$this->column_right_id] - $current_parent[$this->column_left_id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->column_left_id . ' = ' . $this->column_left_id . $diff . ',
|
||||||
|
' . $this->column_right_id . ' = ' . $this->column_right_id . $diff . ',
|
||||||
|
' . $this->column_parent_id . ' = ' . $this->db->sql_case($this->column_parent_id . ' = ' . $current_parent_id, $new_parent_id, $this->column_parent_id) . ',
|
||||||
|
' . $this->column_item_parents . " = ''
|
||||||
|
WHERE " . $this->db->sql_in_set($this->column_item_id, $move_items) . '
|
||||||
|
' . $this->get_sql_where('AND');
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
$this->db->sql_transaction('commit');
|
||||||
|
$this->lock->release();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function change_parent($item_id, $new_parent_id)
|
||||||
|
{
|
||||||
|
$item_id = (int) $item_id;
|
||||||
|
$new_parent_id = (int) $new_parent_id;
|
||||||
|
|
||||||
|
if ($item_id == $new_parent_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$item_id)
|
||||||
|
{
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->acquire_lock();
|
||||||
|
|
||||||
|
$item_data = $this->get_subtree_data($item_id);
|
||||||
|
if (!isset($item_data[$item_id]))
|
||||||
|
{
|
||||||
|
$this->lock->release();
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
|
||||||
|
}
|
||||||
|
|
||||||
|
$item = $item_data[$item_id];
|
||||||
|
$move_items = array_keys($item_data);
|
||||||
|
|
||||||
|
if (in_array($new_parent_id, $move_items))
|
||||||
|
{
|
||||||
|
$this->lock->release();
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
|
||||||
|
}
|
||||||
|
|
||||||
|
$diff = sizeof($move_items) * 2;
|
||||||
|
$sql_exclude_moved_items = $this->db->sql_in_set($this->column_item_id, $move_items, true);
|
||||||
|
|
||||||
|
$this->db->sql_transaction('begin');
|
||||||
|
|
||||||
|
$this->remove_subset($move_items, $item, false, true);
|
||||||
|
|
||||||
|
if ($new_parent_id)
|
||||||
|
{
|
||||||
|
// Retrieve new-parent again, it may have been changed...
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . $this->table_name . '
|
||||||
|
WHERE ' . $this->column_item_id . ' = ' . $new_parent_id;
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$new_parent = $this->db->sql_fetchrow($result);
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (!$new_parent)
|
||||||
|
{
|
||||||
|
$this->db->sql_transaction('rollback');
|
||||||
|
$this->lock->release();
|
||||||
|
throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true);
|
||||||
|
|
||||||
|
if ($new_right_id > (int) $item[$this->column_right_id])
|
||||||
|
{
|
||||||
|
$diff = ' + ' . ($new_right_id - (int) $item[$this->column_right_id] - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$diff = ' - ' . abs($new_right_id - (int) $item[$this->column_right_id] - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'SELECT MAX(' . $this->column_right_id . ') AS ' . $this->column_right_id . '
|
||||||
|
FROM ' . $this->table_name . '
|
||||||
|
WHERE ' . $sql_exclude_moved_items . '
|
||||||
|
' . $this->get_sql_where('AND');
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
$row = $this->db->sql_fetchrow($result);
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$diff = ' + ' . ($row[$this->column_right_id] - (int) $item[$this->column_left_id] + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->column_left_id . ' = ' . $this->column_left_id . $diff . ',
|
||||||
|
' . $this->column_right_id . ' = ' . $this->column_right_id . $diff . ',
|
||||||
|
' . $this->column_parent_id . ' = ' . $this->db->sql_case($this->column_item_id . ' = ' . $item_id, $new_parent_id, $this->column_parent_id) . ',
|
||||||
|
' . $this->column_item_parents . " = ''
|
||||||
|
WHERE " . $this->db->sql_in_set($this->column_item_id, $move_items) . '
|
||||||
|
' . $this->get_sql_where('AND');
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
$this->db->sql_transaction('commit');
|
||||||
|
$this->lock->release();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function get_path_and_subtree_data($item_id, $order_asc = true, $include_item = true)
|
||||||
|
{
|
||||||
|
$condition = 'i2.' . $this->column_left_id . ' BETWEEN i1.' . $this->column_left_id . ' AND i1.' . $this->column_right_id . '
|
||||||
|
OR i1.' . $this->column_left_id . ' BETWEEN i2.' . $this->column_left_id . ' AND i2.' . $this->column_right_id;
|
||||||
|
|
||||||
|
return $this->get_set_of_nodes_data($item_id, $condition, $order_asc, $include_item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function get_path_data($item_id, $order_asc = true, $include_item = true)
|
||||||
|
{
|
||||||
|
$condition = 'i1.' . $this->column_left_id . ' BETWEEN i2.' . $this->column_left_id . ' AND i2.' . $this->column_right_id . '';
|
||||||
|
|
||||||
|
return $this->get_set_of_nodes_data($item_id, $condition, $order_asc, $include_item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function get_subtree_data($item_id, $order_asc = true, $include_item = true)
|
||||||
|
{
|
||||||
|
$condition = 'i2.' . $this->column_left_id . ' BETWEEN i1.' . $this->column_left_id . ' AND i1.' . $this->column_right_id . '';
|
||||||
|
|
||||||
|
return $this->get_set_of_nodes_data($item_id, $condition, $order_asc, $include_item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get items that are related to the given item by the condition
|
||||||
|
*
|
||||||
|
* @param int $item_id Id of the item to retrieve the node set from
|
||||||
|
* @param string $condition Query string restricting the item list
|
||||||
|
* @param bool $order_asc Order the items ascending by their left_id
|
||||||
|
* @param bool $include_item Should the item matching the given item id be included in the list as well
|
||||||
|
* @return array Array of items (containing all columns from the item table)
|
||||||
|
* ID => Item data
|
||||||
|
*/
|
||||||
|
protected function get_set_of_nodes_data($item_id, $condition, $order_asc = true, $include_item = true)
|
||||||
|
{
|
||||||
|
$rows = array();
|
||||||
|
|
||||||
|
$sql = 'SELECT i2.*
|
||||||
|
FROM ' . $this->table_name . ' i1
|
||||||
|
LEFT JOIN ' . $this->table_name . " i2
|
||||||
|
ON (($condition) " . $this->get_sql_where('AND', 'i2.') . ')
|
||||||
|
WHERE i1.' . $this->column_item_id . ' = ' . (int) $item_id . '
|
||||||
|
' . $this->get_sql_where('AND', 'i1.') . '
|
||||||
|
ORDER BY i2.' . $this->column_left_id . ' ' . ($order_asc ? 'ASC' : 'DESC');
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
if (!$include_item && $item_id == $row[$this->column_item_id])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[(int) $row[$this->column_item_id]] = $row;
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get basic data of all parent items
|
||||||
|
*
|
||||||
|
* Basic data is defined in the $item_basic_data property.
|
||||||
|
* Data is cached in the item_parents column in the item table
|
||||||
|
*
|
||||||
|
* @param array $item The item to get the path from
|
||||||
|
* @return array Array of items (containing basic columns from the item table)
|
||||||
|
* ID => Item data
|
||||||
|
*/
|
||||||
|
public function get_path_basic_data(array $item)
|
||||||
|
{
|
||||||
|
$parents = array();
|
||||||
|
if ($item[$this->column_parent_id])
|
||||||
|
{
|
||||||
|
if (!$item[$this->column_item_parents])
|
||||||
|
{
|
||||||
|
$sql = 'SELECT ' . implode(', ', $this->item_basic_data) . '
|
||||||
|
FROM ' . $this->table_name . '
|
||||||
|
WHERE ' . $this->column_left_id . ' < ' . (int) $item[$this->column_left_id] . '
|
||||||
|
AND ' . $this->column_right_id . ' > ' . (int) $item[$this->column_right_id] . '
|
||||||
|
' . $this->get_sql_where('AND') . '
|
||||||
|
ORDER BY ' . $this->column_left_id . ' ASC';
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$parents[$row[$this->column_item_id]] = $row;
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$item_parents = serialize($parents);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->column_item_parents . " = '" . $this->db->sql_escape($item_parents) . "'
|
||||||
|
WHERE " . $this->column_parent_id . ' = ' . (int) $item[$this->column_parent_id];
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$parents = unserialize($item[$this->column_item_parents]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a subset from the nested set
|
||||||
|
*
|
||||||
|
* @param array $subset_items Subset of items to remove
|
||||||
|
* @param array $bounding_item Item containing the right bound of the subset
|
||||||
|
* @param bool $set_subset_zero Should the parent, left and right id of the items be set to 0, or kept unchanged?
|
||||||
|
* In case of removing an item from the tree, we should the values to 0
|
||||||
|
* In case of moving an item, we shouldkeep the original values, in order to allow "+ diff" later
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
protected function remove_subset(array $subset_items, array $bounding_item, $set_subset_zero = true)
|
||||||
|
{
|
||||||
|
$acquired_new_lock = $this->acquire_lock();
|
||||||
|
|
||||||
|
$diff = sizeof($subset_items) * 2;
|
||||||
|
$sql_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items);
|
||||||
|
$sql_not_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items, true);
|
||||||
|
|
||||||
|
$sql_is_parent = $this->column_left_id . ' <= ' . (int) $bounding_item[$this->column_right_id] . '
|
||||||
|
AND ' . $this->column_right_id . ' >= ' . (int) $bounding_item[$this->column_right_id];
|
||||||
|
|
||||||
|
$sql_is_right = $this->column_left_id . ' > ' . (int) $bounding_item[$this->column_right_id];
|
||||||
|
|
||||||
|
$set_left_id = $this->db->sql_case($sql_is_right, $this->column_left_id . ' - ' . $diff, $this->column_left_id);
|
||||||
|
$set_right_id = $this->db->sql_case($sql_is_parent . ' OR ' . $sql_is_right, $this->column_right_id . ' - ' . $diff, $this->column_right_id);
|
||||||
|
|
||||||
|
if ($set_subset_zero)
|
||||||
|
{
|
||||||
|
$set_left_id = $this->db->sql_case($sql_subset_items, 0, $set_left_id);
|
||||||
|
$set_right_id = $this->db->sql_case($sql_subset_items, 0, $set_right_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . (($set_subset_zero) ? $this->column_parent_id . ' = ' . $this->db->sql_case($sql_subset_items, 0, $this->column_parent_id) . ',' : '') . '
|
||||||
|
' . $this->column_left_id . ' = ' . $set_left_id . ',
|
||||||
|
' . $this->column_right_id . ' = ' . $set_right_id . '
|
||||||
|
' . ((!$set_subset_zero) ? ' WHERE ' . $sql_not_subset_items . ' ' . $this->get_sql_where('AND') : $this->get_sql_where('WHERE'));
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
if ($acquired_new_lock)
|
||||||
|
{
|
||||||
|
$this->lock->release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare adding a subset to the nested set
|
||||||
|
*
|
||||||
|
* @param array $subset_items Subset of items to add
|
||||||
|
* @param array $new_parent Item containing the right bound of the new parent
|
||||||
|
* @return int New right id of the parent item
|
||||||
|
*/
|
||||||
|
protected function prepare_adding_subset(array $subset_items, array $new_parent)
|
||||||
|
{
|
||||||
|
$diff = sizeof($subset_items) * 2;
|
||||||
|
$sql_not_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items, true);
|
||||||
|
|
||||||
|
$set_left_id = $this->db->sql_case($this->column_left_id . ' > ' . (int) $new_parent[$this->column_right_id], $this->column_left_id . ' + ' . $diff, $this->column_left_id);
|
||||||
|
$set_right_id = $this->db->sql_case($this->column_right_id . ' >= ' . (int) $new_parent[$this->column_right_id], $this->column_right_id . ' + ' . $diff, $this->column_right_id);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->column_left_id . ' = ' . $set_left_id . ',
|
||||||
|
' . $this->column_right_id . ' = ' . $set_right_id . '
|
||||||
|
WHERE ' . $sql_not_subset_items . '
|
||||||
|
' . $this->get_sql_where('AND');
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
|
return $new_parent[$this->column_right_id] + $diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets values required for the nested set system
|
||||||
|
*
|
||||||
|
* @param array $item Original item data
|
||||||
|
* @return array Original item data + nested set defaults
|
||||||
|
*/
|
||||||
|
protected function reset_nestedset_values(array $item)
|
||||||
|
{
|
||||||
|
$item_data = array_merge($item, array(
|
||||||
|
$this->column_parent_id => 0,
|
||||||
|
$this->column_left_id => 0,
|
||||||
|
$this->column_right_id => 0,
|
||||||
|
$this->column_item_parents => '',
|
||||||
|
));
|
||||||
|
|
||||||
|
unset($item_data[$this->column_item_id]);
|
||||||
|
|
||||||
|
return $item_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regenerate left/right ids from parent/child relationship
|
||||||
|
*
|
||||||
|
* This method regenerates the left/right ids for the tree based on
|
||||||
|
* the parent/child relations. This function executes three queries per
|
||||||
|
* item, so it should only be called, when the set has one of the following
|
||||||
|
* problems:
|
||||||
|
* - The set has a duplicated value inside the left/right id chain
|
||||||
|
* - The set has a missing value inside the left/right id chain
|
||||||
|
* - The set has items that do not have a left/right id set
|
||||||
|
*
|
||||||
|
* When regenerating the items, the items are sorted by parent id and their
|
||||||
|
* current left id, so the current child/parent relationships are kept
|
||||||
|
* and running the function on a working set will not change the order.
|
||||||
|
*
|
||||||
|
* @param int $new_id First left_id to be used (should start with 1)
|
||||||
|
* @param int $parent_id parent_id of the current set (default = 0)
|
||||||
|
* @param bool $reset_ids Should we reset all left_id/right_id on the first call?
|
||||||
|
* @return int $new_id The next left_id/right_id that should be used
|
||||||
|
*/
|
||||||
|
public function regenerate_left_right_ids($new_id, $parent_id = 0, $reset_ids = false)
|
||||||
|
{
|
||||||
|
if ($acquired_new_lock = $this->acquire_lock())
|
||||||
|
{
|
||||||
|
$this->db->sql_transaction('begin');
|
||||||
|
|
||||||
|
if (!$reset_ids)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->column_item_parents . " = ''
|
||||||
|
" . $this->get_sql_where('WHERE');
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($reset_ids)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->db->sql_build_array('UPDATE', array(
|
||||||
|
$this->column_left_id => 0,
|
||||||
|
$this->column_right_id => 0,
|
||||||
|
$this->column_item_parents => '',
|
||||||
|
)) . '
|
||||||
|
' . $this->get_sql_where('WHERE');
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . $this->table_name . '
|
||||||
|
WHERE ' . $this->column_parent_id . ' = ' . (int) $parent_id . '
|
||||||
|
' . $this->get_sql_where('AND') . '
|
||||||
|
ORDER BY ' . $this->column_left_id . ', ' . $this->column_item_id . ' ASC';
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
// First we update the left_id for this module
|
||||||
|
if ($row[$this->column_left_id] != $new_id)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->db->sql_build_array('UPDATE', array($this->column_left_id => $new_id)) . '
|
||||||
|
WHERE ' . $this->column_item_id . ' = ' . (int) $row[$this->column_item_id];
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
}
|
||||||
|
$new_id++;
|
||||||
|
|
||||||
|
// Then we go through any children and update their left/right id's
|
||||||
|
$new_id = $this->regenerate_left_right_ids($new_id, $row[$this->column_item_id]);
|
||||||
|
|
||||||
|
// Then we come back and update the right_id for this module
|
||||||
|
if ($row[$this->column_right_id] != $new_id)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . $this->table_name . '
|
||||||
|
SET ' . $this->db->sql_build_array('UPDATE', array($this->column_right_id => $new_id)) . '
|
||||||
|
WHERE ' . $this->column_item_id . ' = ' . (int) $row[$this->column_item_id];
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
}
|
||||||
|
$new_id++;
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($acquired_new_lock)
|
||||||
|
{
|
||||||
|
$this->db->sql_transaction('commit');
|
||||||
|
$this->lock->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $new_id;
|
||||||
|
}
|
||||||
|
}
|
46
phpBB/includes/tree/nestedset_forum.php
Normal file
46
phpBB/includes/tree/nestedset_forum.php
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package tree
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
class phpbb_tree_nestedset_forum extends phpbb_tree_nestedset
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Construct
|
||||||
|
*
|
||||||
|
* @param phpbb_db_driver $db Database connection
|
||||||
|
* @param phpbb_lock_db $lock Lock class used to lock the table when moving forums around
|
||||||
|
* @param string $table_name Table name
|
||||||
|
*/
|
||||||
|
public function __construct(phpbb_db_driver $db, phpbb_lock_db $lock, $table_name)
|
||||||
|
{
|
||||||
|
parent::__construct(
|
||||||
|
$db,
|
||||||
|
$lock,
|
||||||
|
$table_name,
|
||||||
|
'FORUM_NESTEDSET_',
|
||||||
|
'',
|
||||||
|
array(
|
||||||
|
'forum_id',
|
||||||
|
'forum_name',
|
||||||
|
'forum_type',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'item_id' => 'forum_id',
|
||||||
|
'item_parents' => 'forum_parents',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -416,9 +416,11 @@ class ucp_groups
|
||||||
|
|
||||||
if ($group_id)
|
if ($group_id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT g.*, t.teampage_position AS group_teampage
|
||||||
FROM ' . GROUPS_TABLE . "
|
FROM ' . GROUPS_TABLE . ' g
|
||||||
WHERE group_id = $group_id";
|
LEFT JOIN ' . TEAMPAGE_TABLE . ' t
|
||||||
|
ON (t.group_id = g.group_id)
|
||||||
|
WHERE g.group_id = ' . $group_id;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$group_row = $db->sql_fetchrow($result);
|
$group_row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -514,6 +516,8 @@ class ucp_groups
|
||||||
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,
|
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,
|
||||||
'message_limit' => request_var('group_message_limit', 0),
|
'message_limit' => request_var('group_message_limit', 0),
|
||||||
'max_recipients'=> request_var('group_max_recipients', 0),
|
'max_recipients'=> request_var('group_max_recipients', 0),
|
||||||
|
'legend' => $group_row['group_legend'],
|
||||||
|
'teampage' => $group_row['group_teampage'],
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($config['allow_avatar'])
|
if ($config['allow_avatar'])
|
||||||
|
@ -547,6 +551,9 @@ class ucp_groups
|
||||||
$submit_ary['avatar_width'] = 0;
|
$submit_ary['avatar_width'] = 0;
|
||||||
$submit_ary['avatar_height'] = 0;
|
$submit_ary['avatar_height'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Merge any avatars errors into the primary error array
|
||||||
|
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!check_form_key('ucp_groups'))
|
if (!check_form_key('ucp_groups'))
|
||||||
|
@ -554,11 +561,21 @@ class ucp_groups
|
||||||
$error[] = $user->lang['FORM_INVALID'];
|
$error[] = $user->lang['FORM_INVALID'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate submitted colour value
|
||||||
|
if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour', true))))
|
||||||
|
{
|
||||||
|
// Replace "error" string with its real, localised form
|
||||||
|
$error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error));
|
||||||
|
}
|
||||||
|
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
{
|
{
|
||||||
// Only set the rank, colour, etc. if it's changed or if we're adding a new
|
// Only set the rank, colour, etc. if it's changed or if we're adding a new
|
||||||
// group. This prevents existing group members being updated if no changes
|
// group. This prevents existing group members being updated if no changes
|
||||||
// were made.
|
// were made.
|
||||||
|
// However there are some attributes that need to be set everytime,
|
||||||
|
// otherwise the group gets removed from the feature.
|
||||||
|
$set_attributes = array('legend', 'teampage');
|
||||||
|
|
||||||
$group_attributes = array();
|
$group_attributes = array();
|
||||||
$test_variables = array(
|
$test_variables = array(
|
||||||
|
@ -570,13 +587,14 @@ class ucp_groups
|
||||||
'avatar_height' => 'int',
|
'avatar_height' => 'int',
|
||||||
'receive_pm' => 'int',
|
'receive_pm' => 'int',
|
||||||
'legend' => 'int',
|
'legend' => 'int',
|
||||||
|
'teampage' => 'int',
|
||||||
'message_limit' => 'int',
|
'message_limit' => 'int',
|
||||||
'max_recipients'=> 'int',
|
'max_recipients'=> 'int',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($test_variables as $test => $type)
|
foreach ($test_variables as $test => $type)
|
||||||
{
|
{
|
||||||
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || isset($group_attributes['group_avatar']) && strpos($test, 'avatar') === 0))
|
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || isset($group_attributes['group_avatar']) && strpos($test, 'avatar') === 0 || in_array($test, $set_attributes)))
|
||||||
{
|
{
|
||||||
settype($submit_ary[$test], $type);
|
settype($submit_ary[$test], $type);
|
||||||
$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
|
$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
|
||||||
|
@ -586,6 +604,7 @@ class ucp_groups
|
||||||
if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies)))
|
if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies)))
|
||||||
{
|
{
|
||||||
$cache->destroy('sql', GROUPS_TABLE);
|
$cache->destroy('sql', GROUPS_TABLE);
|
||||||
|
$cache->destroy('sql', TEAMPAGE_TABLE);
|
||||||
|
|
||||||
$message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
|
$message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
|
||||||
trigger_error($user->lang[$message] . $return_page);
|
trigger_error($user->lang[$message] . $return_page);
|
||||||
|
@ -672,8 +691,11 @@ class ucp_groups
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($phpbb_avatar_manager) && !$update)
|
||||||
|
{
|
||||||
// Merge any avatars errors into the primary error array
|
// Merge any avatars errors into the primary error array
|
||||||
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
|
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_EDIT' => true,
|
'S_EDIT' => true,
|
||||||
|
|
|
@ -200,6 +200,10 @@ class ucp_notifications
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$template->assign_vars(array(
|
||||||
|
strtoupper($block) . '_COLS' => sizeof($notification_methods) + 2,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -265,19 +265,16 @@ function compose_pm($id, $mode, $action, $user_folders = array())
|
||||||
// Passworded forum?
|
// Passworded forum?
|
||||||
if ($post['forum_id'])
|
if ($post['forum_id'])
|
||||||
{
|
{
|
||||||
$sql = 'SELECT forum_password
|
$sql = 'SELECT forum_id, forum_name, forum_password
|
||||||
FROM ' . FORUMS_TABLE . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
WHERE forum_id = ' . (int) $post['forum_id'];
|
WHERE forum_id = ' . (int) $post['forum_id'];
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$forum_password = (string) $db->sql_fetchfield('forum_password');
|
$forum_data = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($forum_password)
|
if (!empty($forum_data['forum_password']))
|
||||||
{
|
{
|
||||||
login_forum_box(array(
|
login_forum_box($forum_data);
|
||||||
'forum_id' => $post['forum_id'],
|
|
||||||
'forum_password' => $forum_password,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,11 @@ class ucp_remind
|
||||||
global $config, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_root_path, $phpEx;
|
||||||
global $db, $user, $auth, $template;
|
global $db, $user, $auth, $template;
|
||||||
|
|
||||||
|
if (!$config['allow_password_reset'])
|
||||||
|
{
|
||||||
|
trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'));
|
||||||
|
}
|
||||||
|
|
||||||
$username = request_var('username', '', true);
|
$username = request_var('username', '', true);
|
||||||
$email = strtolower(request_var('email', ''));
|
$email = strtolower(request_var('email', ''));
|
||||||
$submit = (isset($_POST['submit'])) ? true : false;
|
$submit = (isset($_POST['submit'])) ? true : false;
|
||||||
|
|
|
@ -213,8 +213,8 @@ if (!$db_tools->sql_table_exists($table_prefix . 'migrations'))
|
||||||
}
|
}
|
||||||
|
|
||||||
$migrator = $phpbb_container->get('migrator');
|
$migrator = $phpbb_container->get('migrator');
|
||||||
$extension_manager = $phpbb_container->get('ext.manager');
|
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
|
||||||
$finder = $extension_manager->get_finder();
|
$finder = $phpbb_extension_manager->get_finder();
|
||||||
|
|
||||||
$migrations = $finder
|
$migrations = $finder
|
||||||
->core_path('includes/db/migration/data/')
|
->core_path('includes/db/migration/data/')
|
||||||
|
@ -263,9 +263,8 @@ while (!$migrator->finished())
|
||||||
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
||||||
if ((time() - $update_start_time) >= $safe_time_limit)
|
if ((time() - $update_start_time) >= $safe_time_limit)
|
||||||
{
|
{
|
||||||
//echo '<meta http-equiv="refresh" content="0;url=' . str_replace('&', '&', append_sid($phpbb_root_path . 'test.' . $phpEx)) . '" />';
|
|
||||||
echo $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br />';
|
echo $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br />';
|
||||||
echo '<a href="' . append_sid($phpbb_root_path . 'test.' . $phpEx) . '">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>';
|
echo '<a href="' . append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=' . $request->variable('type', 0) . '&language=' . $user->lang['USER_LANG']) . '">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>';
|
||||||
|
|
||||||
phpbb_end_update($cache, $config);
|
phpbb_end_update($cache, $config);
|
||||||
}
|
}
|
||||||
|
@ -276,6 +275,17 @@ if ($orig_version != $config['version'])
|
||||||
add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $config['version']);
|
add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $config['version']);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $user->lang['DATABASE_UPDATE_COMPLETE'];
|
echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '<br />';
|
||||||
|
|
||||||
|
if ($request->variable('type', 0))
|
||||||
|
{
|
||||||
|
echo $user->lang['INLINE_UPDATE_SUCCESSFUL'] . '<br /><br />';
|
||||||
|
echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&sub=file_check&language=' . $user->lang['USER_LANG']) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo '<div class="errorbox">' . $user->lang['UPDATE_FILES_NOTICE'] . '</div>';
|
||||||
|
echo $user->lang['COMPLETE_LOGIN_TO_BOARD'];
|
||||||
|
}
|
||||||
|
|
||||||
phpbb_end_update($cache, $config);
|
phpbb_end_update($cache, $config);
|
||||||
|
|
|
@ -373,6 +373,7 @@ class module
|
||||||
'L_SKIP' => $lang['SKIP'],
|
'L_SKIP' => $lang['SKIP'],
|
||||||
'PAGE_TITLE' => $this->get_page_title(),
|
'PAGE_TITLE' => $this->get_page_title(),
|
||||||
'T_IMAGE_PATH' => htmlspecialchars($phpbb_admin_path) . 'images/',
|
'T_IMAGE_PATH' => htmlspecialchars($phpbb_admin_path) . 'images/',
|
||||||
|
'T_JQUERY_LINK' => $phpbb_root_path . 'assets/javascript/jquery.js',
|
||||||
|
|
||||||
'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
|
'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
|
||||||
'S_CONTENT_FLOW_BEGIN' => ($lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
|
'S_CONTENT_FLOW_BEGIN' => ($lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
|
||||||
|
@ -666,6 +667,21 @@ class module
|
||||||
{
|
{
|
||||||
case 'text':
|
case 'text':
|
||||||
case 'password':
|
case 'password':
|
||||||
|
// HTML5 text-like input types
|
||||||
|
case 'color':
|
||||||
|
case 'date':
|
||||||
|
case 'time':
|
||||||
|
case 'datetime':
|
||||||
|
case 'datetime-local':
|
||||||
|
case 'email':
|
||||||
|
case 'month':
|
||||||
|
case 'number':
|
||||||
|
case 'range':
|
||||||
|
case 'search':
|
||||||
|
case 'tel':
|
||||||
|
case 'url':
|
||||||
|
case 'week':
|
||||||
|
|
||||||
$size = (int) $tpl_type[1];
|
$size = (int) $tpl_type[1];
|
||||||
$maxlength = (int) $tpl_type[2];
|
$maxlength = (int) $tpl_type[2];
|
||||||
|
|
||||||
|
|
|
@ -2065,7 +2065,7 @@ class install_convert extends module
|
||||||
// Because we should not rely on correct settings, we simply use the relative path here directly.
|
// Because we should not rely on correct settings, we simply use the relative path here directly.
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_REFRESH' => true,
|
'S_REFRESH' => true,
|
||||||
'META' => '<meta http-equiv="refresh" content="5;url=' . $url . '" />')
|
'META' => '<meta http-equiv="refresh" content="5; url=' . $url . '" />')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1022,8 +1022,8 @@ class install_install extends module
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace backslashes and doubled slashes (could happen on some proxy setups)
|
// Replace backslashes and doubled slashes (could happen on some proxy setups)
|
||||||
$name = str_replace(array('\\', '//', '/install'), '/', $name);
|
$name = str_replace(array('\\', '//'), '/', $name);
|
||||||
$data['script_path'] = trim(dirname($name));
|
$data['script_path'] = trim(dirname(dirname($name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->advanced_config_options as $config_key => $vars)
|
foreach ($this->advanced_config_options as $config_key => $vars)
|
||||||
|
@ -1977,7 +1977,7 @@ class install_install extends module
|
||||||
'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true),
|
'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true),
|
||||||
'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true),
|
'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true),
|
||||||
'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false),
|
'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false),
|
||||||
'board_email' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => false),
|
'board_email' => array('lang' => 'CONTACT_EMAIL', 'type' => 'email:25:100', 'explain' => false),
|
||||||
);
|
);
|
||||||
var $advanced_config_options = array(
|
var $advanced_config_options = array(
|
||||||
'legend1' => 'ACP_EMAIL_SETTINGS',
|
'legend1' => 'ACP_EMAIL_SETTINGS',
|
||||||
|
|
|
@ -1618,7 +1618,9 @@ class install_update extends module
|
||||||
{
|
{
|
||||||
case 'version_info':
|
case 'version_info':
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
$info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno);
|
|
||||||
|
$info = get_remote_file('version.phpbb.com', '/phpbb',
|
||||||
|
((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno);
|
||||||
|
|
||||||
if ($info !== false)
|
if ($info !== false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -642,17 +642,30 @@ END;;
|
||||||
|
|
||||||
# Table: 'phpbb_notification_types'
|
# Table: 'phpbb_notification_types'
|
||||||
CREATE TABLE phpbb_notification_types (
|
CREATE TABLE phpbb_notification_types (
|
||||||
notification_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
notification_type_id INTEGER NOT NULL,
|
||||||
|
notification_type_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||||
notification_type_enabled INTEGER DEFAULT 1 NOT NULL
|
notification_type_enabled INTEGER DEFAULT 1 NOT NULL
|
||||||
);;
|
);;
|
||||||
|
|
||||||
ALTER TABLE phpbb_notification_types ADD PRIMARY KEY (notification_type, notification_type_enabled);;
|
ALTER TABLE phpbb_notification_types ADD PRIMARY KEY (notification_type_id);;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX phpbb_notification_types_type ON phpbb_notification_types(notification_type_name);;
|
||||||
|
|
||||||
|
CREATE GENERATOR phpbb_notification_types_gen;;
|
||||||
|
SET GENERATOR phpbb_notification_types_gen TO 0;;
|
||||||
|
|
||||||
|
CREATE TRIGGER t_phpbb_notification_types FOR phpbb_notification_types
|
||||||
|
BEFORE INSERT
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
NEW.notification_type_id = GEN_ID(phpbb_notification_types_gen, 1);
|
||||||
|
END;;
|
||||||
|
|
||||||
|
|
||||||
# Table: 'phpbb_notifications'
|
# Table: 'phpbb_notifications'
|
||||||
CREATE TABLE phpbb_notifications (
|
CREATE TABLE phpbb_notifications (
|
||||||
notification_id INTEGER NOT NULL,
|
notification_id INTEGER NOT NULL,
|
||||||
item_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
notification_type_id INTEGER DEFAULT 0 NOT NULL,
|
||||||
item_id INTEGER DEFAULT 0 NOT NULL,
|
item_id INTEGER DEFAULT 0 NOT NULL,
|
||||||
item_parent_id INTEGER DEFAULT 0 NOT NULL,
|
item_parent_id INTEGER DEFAULT 0 NOT NULL,
|
||||||
user_id INTEGER DEFAULT 0 NOT NULL,
|
user_id INTEGER DEFAULT 0 NOT NULL,
|
||||||
|
@ -663,7 +676,7 @@ CREATE TABLE phpbb_notifications (
|
||||||
|
|
||||||
ALTER TABLE phpbb_notifications ADD PRIMARY KEY (notification_id);;
|
ALTER TABLE phpbb_notifications ADD PRIMARY KEY (notification_id);;
|
||||||
|
|
||||||
CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications(item_type, item_id);;
|
CREATE INDEX phpbb_notifications_item_ident ON phpbb_notifications(notification_type_id, item_id);;
|
||||||
CREATE INDEX phpbb_notifications_user ON phpbb_notifications(user_id, notification_read);;
|
CREATE INDEX phpbb_notifications_user ON phpbb_notifications(user_id, notification_read);;
|
||||||
|
|
||||||
CREATE GENERATOR phpbb_notifications_gen;;
|
CREATE GENERATOR phpbb_notifications_gen;;
|
||||||
|
|
|
@ -793,7 +793,8 @@ GO
|
||||||
Table: 'phpbb_notification_types'
|
Table: 'phpbb_notification_types'
|
||||||
*/
|
*/
|
||||||
CREATE TABLE [phpbb_notification_types] (
|
CREATE TABLE [phpbb_notification_types] (
|
||||||
[notification_type] [varchar] (255) DEFAULT ('') NOT NULL ,
|
[notification_type_id] [int] IDENTITY (1, 1) NOT NULL ,
|
||||||
|
[notification_type_name] [varchar] (255) DEFAULT ('') NOT NULL ,
|
||||||
[notification_type_enabled] [int] DEFAULT (1) NOT NULL
|
[notification_type_enabled] [int] DEFAULT (1) NOT NULL
|
||||||
) ON [PRIMARY]
|
) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
@ -801,18 +802,20 @@ GO
|
||||||
ALTER TABLE [phpbb_notification_types] WITH NOCHECK ADD
|
ALTER TABLE [phpbb_notification_types] WITH NOCHECK ADD
|
||||||
CONSTRAINT [PK_phpbb_notification_types] PRIMARY KEY CLUSTERED
|
CONSTRAINT [PK_phpbb_notification_types] PRIMARY KEY CLUSTERED
|
||||||
(
|
(
|
||||||
[notification_type],
|
[notification_type_id]
|
||||||
[notification_type_enabled]
|
|
||||||
) ON [PRIMARY]
|
) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX [type] ON [phpbb_notification_types]([notification_type_name]) ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Table: 'phpbb_notifications'
|
Table: 'phpbb_notifications'
|
||||||
*/
|
*/
|
||||||
CREATE TABLE [phpbb_notifications] (
|
CREATE TABLE [phpbb_notifications] (
|
||||||
[notification_id] [int] IDENTITY (1, 1) NOT NULL ,
|
[notification_id] [int] IDENTITY (1, 1) NOT NULL ,
|
||||||
[item_type] [varchar] (255) DEFAULT ('') NOT NULL ,
|
[notification_type_id] [int] DEFAULT (0) NOT NULL ,
|
||||||
[item_id] [int] DEFAULT (0) NOT NULL ,
|
[item_id] [int] DEFAULT (0) NOT NULL ,
|
||||||
[item_parent_id] [int] DEFAULT (0) NOT NULL ,
|
[item_parent_id] [int] DEFAULT (0) NOT NULL ,
|
||||||
[user_id] [int] DEFAULT (0) NOT NULL ,
|
[user_id] [int] DEFAULT (0) NOT NULL ,
|
||||||
|
@ -829,7 +832,7 @@ ALTER TABLE [phpbb_notifications] WITH NOCHECK ADD
|
||||||
) ON [PRIMARY]
|
) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
CREATE INDEX [item_ident] ON [phpbb_notifications]([item_type], [item_id]) ON [PRIMARY]
|
CREATE INDEX [item_ident] ON [phpbb_notifications]([notification_type_id], [item_id]) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
CREATE INDEX [user] ON [phpbb_notifications]([user_id], [notification_read]) ON [PRIMARY]
|
CREATE INDEX [user] ON [phpbb_notifications]([user_id], [notification_read]) ON [PRIMARY]
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue