aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-07-23 11:13:25 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2013-07-23 11:13:25 -0500
commit485c6ab3553f518b157610ee1144bbcbef63f797 (patch)
tree0c50392c4716511e118eeabd3f48cceb3ac7e906
parent41d8bfa974900c9befbde06cc08060eb8a552ec8 (diff)
parentbe59885d5fd4b44f1c43994dec928eda816f9ab8 (diff)
downloadforums-485c6ab3553f518b157610ee1144bbcbef63f797.tar
forums-485c6ab3553f518b157610ee1144bbcbef63f797.tar.gz
forums-485c6ab3553f518b157610ee1144bbcbef63f797.tar.bz2
forums-485c6ab3553f518b157610ee1144bbcbef63f797.tar.xz
forums-485c6ab3553f518b157610ee1144bbcbef63f797.zip
Merge branch 'develop' of github.com:phpbb/phpbb3 into ticket/11667
# By Joas Schilling (224) and others # Via Andreas Fischer (23) and others * 'develop' of github.com:phpbb/phpbb3: (385 commits) [ticket/11734] Readd accidently removed language strings of forum permissions [ticket/11620] Whitespace and combine function into test_case [ticket/11620] Move check_ban_test functions to setUp/tearDown for clarity [ticket/11620] Changed incorrect global variable [ticket/11620] Minor indentation changes and comment clarity [ticket/11733] Fix "Illegal offset type" Warning caused by overall feed [ticket/11733] Add browse test for feed.php [ticket/11731] Remove static calls to captcha garbage collector [ticket/11728] Replace topic_approved with topic_visibility [ticket/11620] Expected and actual test conditions wrongly swapped [ticket/11620] Space between . in directory import concatenation [ticket/11620] Changes to match merge [ticket/11620] Changes for code guidelines consistency [ticket/11620] Fix a static calls to non-static for session captcha [ticket/11620] Cleanup creation_test that was renamed on a cherry-pick [ticket/11620] Update auth_provider for new interface [ticket/11620] Added garbage_collection_test [ticket/11620] Fixed check_ban_test errors with cache and ban warning message [ticket/11620] Fixed a typo on check_ban_test [ticket/11620] Refactored check_isvalid_test to use session_test_case ...
-rw-r--r--build/build.xml44
-rw-r--r--phpBB/adm/style/acp_board.html2
-rw-r--r--phpBB/adm/style/ajax.js6
-rw-r--r--phpBB/adm/style/auth_provider_ldap.html32
-rw-r--r--phpBB/adm/style/overall_footer.html2
-rw-r--r--phpBB/adm/style/permission_roles_mask.html2
-rw-r--r--phpBB/common.php6
-rw-r--r--phpBB/composer.json3
-rw-r--r--phpBB/composer.lock97
-rw-r--r--phpBB/config/feed.yml7
-rw-r--r--phpBB/config/services.yml23
-rw-r--r--phpBB/config/tables.yml3
-rw-r--r--phpBB/develop/benchmark.php10
-rw-r--r--phpBB/develop/create_schema_files.php30
-rw-r--r--phpBB/develop/fill.php2
-rw-r--r--phpBB/develop/merge_post_tables.php4
-rw-r--r--phpBB/develop/mysql_upgrader.php24
-rw-r--r--phpBB/docs/CHANGELOG.html190
-rw-r--r--phpBB/docs/FAQ.html12
-rw-r--r--phpBB/docs/INSTALL.html12
-rw-r--r--phpBB/docs/README.html28
-rw-r--r--phpBB/docs/auth_api.html2
-rw-r--r--phpBB/docs/coding-guidelines.html4
-rw-r--r--phpBB/docs/hook_system.html2
-rw-r--r--phpBB/docs/sphinx.sample.conf3
-rw-r--r--phpBB/download/file.php4
-rw-r--r--phpBB/includes/acp/acp_board.php19
-rw-r--r--phpBB/includes/acp/acp_database.php4
-rw-r--r--phpBB/includes/acp/acp_forums.php37
-rw-r--r--phpBB/includes/acp/acp_groups.php3
-rw-r--r--phpBB/includes/acp/acp_main.php12
-rw-r--r--phpBB/includes/acp/acp_modules.php18
-rw-r--r--phpBB/includes/acp/acp_permission_roles.php19
-rw-r--r--phpBB/includes/acp/acp_permissions.php15
-rw-r--r--phpBB/includes/acp/acp_search.php2
-rw-r--r--phpBB/includes/acp/acp_send_statistics.php2
-rw-r--r--phpBB/includes/acp/acp_users.php16
-rw-r--r--phpBB/includes/acp/auth.php37
-rw-r--r--phpBB/includes/captcha/captcha_factory.php3
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php12
-rw-r--r--phpBB/includes/constants.php4
-rw-r--r--phpBB/includes/functions.php15
-rw-r--r--phpBB/includes/functions_acp.php2
-rw-r--r--phpBB/includes/functions_admin.php194
-rw-r--r--phpBB/includes/functions_convert.php6
-rw-r--r--phpBB/includes/functions_display.php125
-rw-r--r--phpBB/includes/functions_install.php6
-rw-r--r--phpBB/includes/functions_posting.php571
-rw-r--r--phpBB/includes/mcp/info/mcp_queue.php2
-rw-r--r--phpBB/includes/mcp/mcp_forum.php21
-rw-r--r--phpBB/includes/mcp/mcp_front.php4
-rw-r--r--phpBB/includes/mcp/mcp_main.php482
-rw-r--r--phpBB/includes/mcp/mcp_post.php35
-rw-r--r--phpBB/includes/mcp/mcp_queue.php1085
-rw-r--r--phpBB/includes/mcp/mcp_reports.php8
-rw-r--r--phpBB/includes/mcp/mcp_topic.php50
-rw-r--r--phpBB/includes/ucp/ucp_main.php6
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php2
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php10
-rw-r--r--phpBB/install/convertors/functions_phpbb20.php9
-rw-r--r--phpBB/install/database_update.php6
-rw-r--r--phpBB/install/index.php4
-rw-r--r--phpBB/install/install_convert.php1
-rw-r--r--phpBB/install/install_install.php6
-rw-r--r--phpBB/install/schemas/firebird_schema.sql34
-rw-r--r--phpBB/install/schemas/mssql_schema.sql34
-rw-r--r--phpBB/install/schemas/mysql_40_schema.sql30
-rw-r--r--phpBB/install/schemas/mysql_41_schema.sql30
-rw-r--r--phpBB/install/schemas/oracle_schema.sql30
-rw-r--r--phpBB/install/schemas/postgres_schema.sql30
-rw-r--r--phpBB/install/schemas/schema_data.sql13
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql34
-rw-r--r--phpBB/language/en/acp/common.php7
-rw-r--r--phpBB/language/en/acp/permissions.php2
-rw-r--r--phpBB/language/en/acp/permissions_phpbb.php334
-rw-r--r--phpBB/language/en/common.php6
-rw-r--r--phpBB/language/en/help_faq.php2
-rw-r--r--phpBB/language/en/install.php14
-rw-r--r--phpBB/language/en/mcp.php29
-rw-r--r--phpBB/language/en/posting.php14
-rw-r--r--phpBB/language/en/ucp.php2
-rw-r--r--phpBB/language/en/viewtopic.php4
-rw-r--r--phpBB/mcp.php32
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/phpbb/auth/auth.php (renamed from phpBB/includes/auth/auth.php)0
-rw-r--r--phpBB/phpbb/auth/index.htm (renamed from phpBB/includes/auth/index.htm)0
-rw-r--r--phpBB/phpbb/auth/provider/apache.php (renamed from phpBB/includes/auth/provider/apache.php)18
-rw-r--r--phpBB/phpbb/auth/provider/base.php72
-rw-r--r--phpBB/phpbb/auth/provider/db.php (renamed from phpBB/includes/auth/provider/db.php)42
-rw-r--r--phpBB/phpbb/auth/provider/index.htm (renamed from phpBB/includes/auth/provider/index.htm)0
-rw-r--r--phpBB/phpbb/auth/provider/interface.php (renamed from phpBB/includes/auth/provider/interface.php)24
-rw-r--r--phpBB/phpbb/auth/provider/ldap.php (renamed from phpBB/includes/auth/provider/ldap.php)78
-rw-r--r--phpBB/phpbb/avatar/driver/driver.php (renamed from phpBB/includes/avatar/driver/driver.php)0
-rw-r--r--phpBB/phpbb/avatar/driver/gravatar.php (renamed from phpBB/includes/avatar/driver/gravatar.php)0
-rw-r--r--phpBB/phpbb/avatar/driver/interface.php (renamed from phpBB/includes/avatar/driver/interface.php)0
-rw-r--r--phpBB/phpbb/avatar/driver/local.php (renamed from phpBB/includes/avatar/driver/local.php)0
-rw-r--r--phpBB/phpbb/avatar/driver/remote.php (renamed from phpBB/includes/avatar/driver/remote.php)2
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php (renamed from phpBB/includes/avatar/driver/upload.php)26
-rw-r--r--phpBB/phpbb/avatar/manager.php (renamed from phpBB/includes/avatar/manager.php)0
-rw-r--r--phpBB/phpbb/cache/driver/apc.php (renamed from phpBB/includes/cache/driver/apc.php)0
-rw-r--r--phpBB/phpbb/cache/driver/base.php (renamed from phpBB/includes/cache/driver/base.php)0
-rw-r--r--phpBB/phpbb/cache/driver/eaccelerator.php (renamed from phpBB/includes/cache/driver/eaccelerator.php)0
-rw-r--r--phpBB/phpbb/cache/driver/file.php (renamed from phpBB/includes/cache/driver/file.php)0
-rw-r--r--phpBB/phpbb/cache/driver/interface.php (renamed from phpBB/includes/cache/driver/interface.php)0
-rw-r--r--phpBB/phpbb/cache/driver/memcache.php (renamed from phpBB/includes/cache/driver/memcache.php)0
-rw-r--r--phpBB/phpbb/cache/driver/memory.php (renamed from phpBB/includes/cache/driver/memory.php)0
-rw-r--r--phpBB/phpbb/cache/driver/null.php (renamed from phpBB/includes/cache/driver/null.php)0
-rw-r--r--phpBB/phpbb/cache/driver/redis.php (renamed from phpBB/includes/cache/driver/redis.php)0
-rw-r--r--phpBB/phpbb/cache/driver/wincache.php (renamed from phpBB/includes/cache/driver/wincache.php)0
-rw-r--r--phpBB/phpbb/cache/driver/xcache.php (renamed from phpBB/includes/cache/driver/xcache.php)0
-rw-r--r--phpBB/phpbb/cache/service.php (renamed from phpBB/includes/cache/service.php)0
-rw-r--r--phpBB/phpbb/class_loader.php (renamed from phpBB/includes/class_loader.php)0
-rw-r--r--phpBB/phpbb/config/config.php (renamed from phpBB/includes/config/config.php)0
-rw-r--r--phpBB/phpbb/config/db.php (renamed from phpBB/includes/config/db.php)0
-rw-r--r--phpBB/phpbb/config/db_text.php (renamed from phpBB/includes/config/db_text.php)0
-rw-r--r--phpBB/phpbb/content_visibility.php651
-rw-r--r--phpBB/phpbb/controller/exception.php (renamed from phpBB/includes/controller/exception.php)0
-rw-r--r--phpBB/phpbb/controller/helper.php (renamed from phpBB/includes/controller/helper.php)0
-rw-r--r--phpBB/phpbb/controller/provider.php (renamed from phpBB/includes/controller/provider.php)0
-rw-r--r--phpBB/phpbb/controller/resolver.php (renamed from phpBB/includes/controller/resolver.php)0
-rw-r--r--phpBB/phpbb/cron/manager.php (renamed from phpBB/includes/cron/manager.php)0
-rw-r--r--phpBB/phpbb/cron/task/base.php (renamed from phpBB/includes/cron/task/base.php)0
-rw-r--r--phpBB/phpbb/cron/task/core/prune_all_forums.php (renamed from phpBB/includes/cron/task/core/prune_all_forums.php)0
-rw-r--r--phpBB/phpbb/cron/task/core/prune_forum.php (renamed from phpBB/includes/cron/task/core/prune_forum.php)0
-rw-r--r--phpBB/phpbb/cron/task/core/queue.php (renamed from phpBB/includes/cron/task/core/queue.php)0
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_cache.php (renamed from phpBB/includes/cron/task/core/tidy_cache.php)0
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_database.php (renamed from phpBB/includes/cron/task/core/tidy_database.php)0
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_search.php (renamed from phpBB/includes/cron/task/core/tidy_search.php)7
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_sessions.php (renamed from phpBB/includes/cron/task/core/tidy_sessions.php)0
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_warnings.php (renamed from phpBB/includes/cron/task/core/tidy_warnings.php)0
-rw-r--r--phpBB/phpbb/cron/task/parametrized.php (renamed from phpBB/includes/cron/task/parametrized.php)0
-rw-r--r--phpBB/phpbb/cron/task/task.php (renamed from phpBB/includes/cron/task/task.php)0
-rw-r--r--phpBB/phpbb/cron/task/wrapper.php (renamed from phpBB/includes/cron/task/wrapper.php)0
-rw-r--r--phpBB/phpbb/datetime.php (renamed from phpBB/includes/datetime.php)0
-rw-r--r--phpBB/phpbb/db/driver/driver.php (renamed from phpBB/includes/db/driver/driver.php)2
-rw-r--r--phpBB/phpbb/db/driver/firebird.php (renamed from phpBB/includes/db/driver/firebird.php)0
-rw-r--r--phpBB/phpbb/db/driver/mssql.php (renamed from phpBB/includes/db/driver/mssql.php)0
-rw-r--r--phpBB/phpbb/db/driver/mssql_base.php (renamed from phpBB/includes/db/driver/mssql_base.php)0
-rw-r--r--phpBB/phpbb/db/driver/mssql_odbc.php (renamed from phpBB/includes/db/driver/mssql_odbc.php)0
-rw-r--r--phpBB/phpbb/db/driver/mssqlnative.php (renamed from phpBB/includes/db/driver/mssqlnative.php)0
-rw-r--r--phpBB/phpbb/db/driver/mysql.php (renamed from phpBB/includes/db/driver/mysql.php)0
-rw-r--r--phpBB/phpbb/db/driver/mysql_base.php (renamed from phpBB/includes/db/driver/mysql_base.php)0
-rw-r--r--phpBB/phpbb/db/driver/mysqli.php (renamed from phpBB/includes/db/driver/mysqli.php)0
-rw-r--r--phpBB/phpbb/db/driver/oracle.php (renamed from phpBB/includes/db/driver/oracle.php)0
-rw-r--r--phpBB/phpbb/db/driver/postgres.php (renamed from phpBB/includes/db/driver/postgres.php)0
-rw-r--r--phpBB/phpbb/db/driver/sqlite.php (renamed from phpBB/includes/db/driver/sqlite.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_10.php (renamed from phpBB/includes/db/migration/data/30x/3_0_10.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_10_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php (renamed from phpBB/includes/db/migration/data/30x/3_0_10_rc2.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php (renamed from phpBB/includes/db/migration/data/30x/3_0_10_rc3.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_11.php (renamed from phpBB/includes/db/migration/data/30x/3_0_11.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_11_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php (renamed from phpBB/includes/db/migration/data/30x/3_0_11_rc2.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_12_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_1_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_2.php (renamed from phpBB/includes/db/migration/data/30x/3_0_2.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_2_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php (renamed from phpBB/includes/db/migration/data/30x/3_0_2_rc2.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_3.php (renamed from phpBB/includes/db/migration/data/30x/3_0_3.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_3_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_4.php (renamed from phpBB/includes/db/migration/data/30x/3_0_4.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_4_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_5.php (renamed from phpBB/includes/db/migration/data/30x/3_0_5.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_5_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php (renamed from phpBB/includes/db/migration/data/30x/3_0_5_rc1part2.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_6.php (renamed from phpBB/includes/db/migration/data/30x/3_0_6.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_6_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php (renamed from phpBB/includes/db/migration/data/30x/3_0_6_rc2.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php (renamed from phpBB/includes/db/migration/data/30x/3_0_6_rc3.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php (renamed from phpBB/includes/db/migration/data/30x/3_0_6_rc4.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_7.php (renamed from phpBB/includes/db/migration/data/30x/3_0_7.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_7_pl1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_7_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php (renamed from phpBB/includes/db/migration/data/30x/3_0_7_rc2.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_8.php (renamed from phpBB/includes/db/migration/data/30x/3_0_8.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_8_rc1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_9.php (renamed from phpBB/includes/db/migration/data/30x/3_0_9.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_9_rc1.php)4
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php (renamed from phpBB/includes/db/migration/data/30x/3_0_9_rc2.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php (renamed from phpBB/includes/db/migration/data/30x/3_0_9_rc3.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php (renamed from phpBB/includes/db/migration/data/30x/3_0_9_rc4.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php (renamed from phpBB/includes/db/migration/data/30x/local_url_bbcode.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/avatars.php (renamed from phpBB/includes/db/migration/data/310/avatars.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/boardindex.php (renamed from phpBB/includes/db/migration/data/310/boardindex.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/config_db_text.php (renamed from phpBB/includes/db/migration/data/310/config_db_text.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/dev.php (renamed from phpBB/includes/db/migration/data/310/dev.php)5
-rw-r--r--phpBB/phpbb/db/migration/data/310/extensions.php (renamed from phpBB/includes/db/migration/data/310/extensions.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/forgot_password.php (renamed from phpBB/includes/db/migration/data/310/forgot_password.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/jquery_update.php (renamed from phpBB/includes/db/migration/data/310/jquery_update.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php118
-rw-r--r--phpBB/phpbb/db/migration/data/310/notifications.php (renamed from phpBB/includes/db/migration/data/310/notifications.php)64
-rw-r--r--phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php (renamed from phpBB/includes/db/migration/data/310/notifications_schema_fix.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/reported_posts_display.php (renamed from phpBB/includes/db/migration/data/310/reported_posts_display.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/signature_module_auth.php (renamed from phpBB/includes/db/migration/data/310/signature_module_auth.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/softdelete_p1.php171
-rw-r--r--phpBB/phpbb/db/migration/data/310/softdelete_p2.php68
-rw-r--r--phpBB/phpbb/db/migration/data/310/style_update_p1.php (renamed from phpBB/includes/db/migration/data/310/style_update_p1.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/style_update_p2.php (renamed from phpBB/includes/db/migration/data/310/style_update_p2.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/teampage.php (renamed from phpBB/includes/db/migration/data/310/teampage.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/timezone.php (renamed from phpBB/includes/db/migration/data/310/timezone.php)0
-rw-r--r--phpBB/phpbb/db/migration/data/310/timezone_p2.php (renamed from phpBB/includes/db/migration/data/310/timezone_p2.php)0
-rw-r--r--phpBB/phpbb/db/migration/exception.php (renamed from phpBB/includes/db/migration/exception.php)0
-rw-r--r--phpBB/phpbb/db/migration/migration.php (renamed from phpBB/includes/db/migration/migration.php)0
-rw-r--r--phpBB/phpbb/db/migration/tool/config.php (renamed from phpBB/includes/db/migration/tool/config.php)0
-rw-r--r--phpBB/phpbb/db/migration/tool/interface.php (renamed from phpBB/includes/db/migration/tool/interface.php)0
-rw-r--r--phpBB/phpbb/db/migration/tool/module.php (renamed from phpBB/includes/db/migration/tool/module.php)0
-rw-r--r--phpBB/phpbb/db/migration/tool/permission.php (renamed from phpBB/includes/db/migration/tool/permission.php)0
-rw-r--r--phpBB/phpbb/db/migrator.php (renamed from phpBB/includes/db/migrator.php)0
-rw-r--r--phpBB/phpbb/db/sql_insert_buffer.php (renamed from phpBB/includes/db/sql_insert_buffer.php)0
-rw-r--r--phpBB/phpbb/db/tools.php (renamed from phpBB/includes/db/db_tools.php)2
-rw-r--r--phpBB/phpbb/di/extension/config.php (renamed from phpBB/includes/di/extension/config.php)0
-rw-r--r--phpBB/phpbb/di/extension/core.php (renamed from phpBB/includes/di/extension/core.php)0
-rw-r--r--phpBB/phpbb/di/extension/ext.php (renamed from phpBB/includes/di/extension/ext.php)0
-rw-r--r--phpBB/phpbb/di/pass/collection_pass.php (renamed from phpBB/includes/di/pass/collection_pass.php)0
-rw-r--r--phpBB/phpbb/di/pass/kernel_pass.php (renamed from phpBB/includes/di/pass/kernel_pass.php)0
-rw-r--r--phpBB/phpbb/di/service_collection.php (renamed from phpBB/includes/di/service_collection.php)0
-rw-r--r--phpBB/phpbb/error_collector.php (renamed from phpBB/includes/error_collector.php)0
-rw-r--r--phpBB/phpbb/event/data.php (renamed from phpBB/includes/event/data.php)0
-rw-r--r--phpBB/phpbb/event/dispatcher.php (renamed from phpBB/includes/event/dispatcher.php)0
-rw-r--r--phpBB/phpbb/event/extension_subscriber_loader.php (renamed from phpBB/includes/event/extension_subscriber_loader.php)0
-rw-r--r--phpBB/phpbb/event/kernel_exception_subscriber.php (renamed from phpBB/includes/event/kernel_exception_subscriber.php)0
-rw-r--r--phpBB/phpbb/event/kernel_request_subscriber.php (renamed from phpBB/includes/event/kernel_request_subscriber.php)0
-rw-r--r--phpBB/phpbb/event/kernel_terminate_subscriber.php (renamed from phpBB/includes/event/kernel_terminate_subscriber.php)0
-rw-r--r--phpBB/phpbb/extension/base.php (renamed from phpBB/includes/extension/base.php)0
-rw-r--r--phpBB/phpbb/extension/exception.php (renamed from phpBB/includes/extension/exception.php)0
-rw-r--r--phpBB/phpbb/extension/finder.php (renamed from phpBB/includes/extension/finder.php)4
-rw-r--r--phpBB/phpbb/extension/interface.php (renamed from phpBB/includes/extension/interface.php)0
-rw-r--r--phpBB/phpbb/extension/manager.php (renamed from phpBB/includes/extension/manager.php)0
-rw-r--r--phpBB/phpbb/extension/metadata_manager.php (renamed from phpBB/includes/extension/metadata_manager.php)0
-rw-r--r--phpBB/phpbb/extension/provider.php (renamed from phpBB/includes/extension/provider.php)0
-rw-r--r--phpBB/phpbb/feed/base.php (renamed from phpBB/includes/feed/base.php)4
-rw-r--r--phpBB/phpbb/feed/factory.php (renamed from phpBB/includes/feed/factory.php)0
-rw-r--r--phpBB/phpbb/feed/forum.php (renamed from phpBB/includes/feed/forum.php)8
-rw-r--r--phpBB/phpbb/feed/forums.php (renamed from phpBB/includes/feed/forums.php)6
-rw-r--r--phpBB/phpbb/feed/helper.php (renamed from phpBB/includes/feed/helper.php)0
-rw-r--r--phpBB/phpbb/feed/news.php (renamed from phpBB/includes/feed/news.php)4
-rw-r--r--phpBB/phpbb/feed/overall.php (renamed from phpBB/includes/feed/overall.php)15
-rw-r--r--phpBB/phpbb/feed/post_base.php (renamed from phpBB/includes/feed/post_base.php)2
-rw-r--r--phpBB/phpbb/feed/topic.php (renamed from phpBB/includes/feed/topic.php)8
-rw-r--r--phpBB/phpbb/feed/topic_base.php (renamed from phpBB/includes/feed/topic_base.php)4
-rw-r--r--phpBB/phpbb/feed/topics.php (renamed from phpBB/includes/feed/topics.php)4
-rw-r--r--phpBB/phpbb/feed/topics_active.php (renamed from phpBB/includes/feed/topics_active.php)4
-rw-r--r--phpBB/phpbb/filesystem.php (renamed from phpBB/includes/filesystem.php)0
-rw-r--r--phpBB/phpbb/groupposition/exception.php (renamed from phpBB/includes/groupposition/exception.php)0
-rw-r--r--phpBB/phpbb/groupposition/interface.php (renamed from phpBB/includes/groupposition/interface.php)0
-rw-r--r--phpBB/phpbb/groupposition/legend.php (renamed from phpBB/includes/groupposition/legend.php)0
-rw-r--r--phpBB/phpbb/groupposition/teampage.php (renamed from phpBB/includes/groupposition/teampage.php)0
-rw-r--r--phpBB/phpbb/hook/finder.php (renamed from phpBB/includes/hook/finder.php)0
-rw-r--r--phpBB/phpbb/json_response.php (renamed from phpBB/includes/json_response.php)0
-rw-r--r--phpBB/phpbb/lock/db.php (renamed from phpBB/includes/lock/db.php)0
-rw-r--r--phpBB/phpbb/lock/flock.php (renamed from phpBB/includes/lock/flock.php)0
-rw-r--r--phpBB/phpbb/log/interface.php (renamed from phpBB/includes/log/interface.php)0
-rw-r--r--phpBB/phpbb/log/log.php (renamed from phpBB/includes/log/log.php)0
-rw-r--r--phpBB/phpbb/notification/exception.php (renamed from phpBB/includes/notification/exception.php)0
-rw-r--r--phpBB/phpbb/notification/manager.php (renamed from phpBB/includes/notification/manager.php)0
-rw-r--r--phpBB/phpbb/notification/method/base.php (renamed from phpBB/includes/notification/method/base.php)0
-rw-r--r--phpBB/phpbb/notification/method/email.php (renamed from phpBB/includes/notification/method/email.php)0
-rw-r--r--phpBB/phpbb/notification/method/interface.php (renamed from phpBB/includes/notification/method/interface.php)0
-rw-r--r--phpBB/phpbb/notification/method/jabber.php (renamed from phpBB/includes/notification/method/jabber.php)0
-rw-r--r--phpBB/phpbb/notification/method/messenger_base.php (renamed from phpBB/includes/notification/method/messenger_base.php)0
-rw-r--r--phpBB/phpbb/notification/type/approve_post.php (renamed from phpBB/includes/notification/type/approve_post.php)0
-rw-r--r--phpBB/phpbb/notification/type/approve_topic.php (renamed from phpBB/includes/notification/type/approve_topic.php)0
-rw-r--r--phpBB/phpbb/notification/type/base.php (renamed from phpBB/includes/notification/type/base.php)0
-rw-r--r--phpBB/phpbb/notification/type/bookmark.php (renamed from phpBB/includes/notification/type/bookmark.php)0
-rw-r--r--phpBB/phpbb/notification/type/disapprove_post.php (renamed from phpBB/includes/notification/type/disapprove_post.php)0
-rw-r--r--phpBB/phpbb/notification/type/disapprove_topic.php (renamed from phpBB/includes/notification/type/disapprove_topic.php)0
-rw-r--r--phpBB/phpbb/notification/type/interface.php (renamed from phpBB/includes/notification/type/interface.php)0
-rw-r--r--phpBB/phpbb/notification/type/pm.php (renamed from phpBB/includes/notification/type/pm.php)0
-rw-r--r--phpBB/phpbb/notification/type/post.php (renamed from phpBB/includes/notification/type/post.php)0
-rw-r--r--phpBB/phpbb/notification/type/post_in_queue.php (renamed from phpBB/includes/notification/type/post_in_queue.php)0
-rw-r--r--phpBB/phpbb/notification/type/quote.php (renamed from phpBB/includes/notification/type/quote.php)0
-rw-r--r--phpBB/phpbb/notification/type/report_pm.php (renamed from phpBB/includes/notification/type/report_pm.php)0
-rw-r--r--phpBB/phpbb/notification/type/report_pm_closed.php (renamed from phpBB/includes/notification/type/report_pm_closed.php)0
-rw-r--r--phpBB/phpbb/notification/type/report_post.php (renamed from phpBB/includes/notification/type/report_post.php)0
-rw-r--r--phpBB/phpbb/notification/type/report_post_closed.php (renamed from phpBB/includes/notification/type/report_post_closed.php)0
-rw-r--r--phpBB/phpbb/notification/type/topic.php (renamed from phpBB/includes/notification/type/topic.php)0
-rw-r--r--phpBB/phpbb/notification/type/topic_in_queue.php (renamed from phpBB/includes/notification/type/topic_in_queue.php)0
-rw-r--r--phpBB/phpbb/permissions.php340
-rw-r--r--phpBB/phpbb/php/ini.php (renamed from phpBB/includes/php/ini.php)0
-rw-r--r--phpBB/phpbb/request/deactivated_super_global.php (renamed from phpBB/includes/request/deactivated_super_global.php)0
-rw-r--r--phpBB/phpbb/request/interface.php (renamed from phpBB/includes/request/interface.php)0
-rw-r--r--phpBB/phpbb/request/request.php (renamed from phpBB/includes/request/request.php)0
-rw-r--r--phpBB/phpbb/request/type_cast_helper.php (renamed from phpBB/includes/request/type_cast_helper.php)0
-rw-r--r--phpBB/phpbb/request/type_cast_helper_interface.php (renamed from phpBB/includes/request/type_cast_helper_interface.php)0
-rw-r--r--phpBB/phpbb/search/base.php (renamed from phpBB/includes/search/base.php)0
-rw-r--r--phpBB/phpbb/search/fulltext_mysql.php (renamed from phpBB/includes/search/fulltext_mysql.php)40
-rw-r--r--phpBB/phpbb/search/fulltext_native.php (renamed from phpBB/includes/search/fulltext_native.php)43
-rw-r--r--phpBB/phpbb/search/fulltext_postgres.php (renamed from phpBB/includes/search/fulltext_postgres.php)40
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php (renamed from phpBB/includes/search/fulltext_sphinx.php)23
-rw-r--r--phpBB/phpbb/search/index.htm (renamed from phpBB/includes/search/index.htm)0
-rw-r--r--phpBB/phpbb/search/sphinx/config.php (renamed from phpBB/includes/search/sphinx/config.php)0
-rw-r--r--phpBB/phpbb/search/sphinx/config_comment.php (renamed from phpBB/includes/search/sphinx/config_comment.php)0
-rw-r--r--phpBB/phpbb/search/sphinx/config_section.php (renamed from phpBB/includes/search/sphinx/config_section.php)0
-rw-r--r--phpBB/phpbb/search/sphinx/config_variable.php (renamed from phpBB/includes/search/sphinx/config_variable.php)0
-rw-r--r--phpBB/phpbb/session.php (renamed from phpBB/includes/session.php)9
-rw-r--r--phpBB/phpbb/style/extension_path_provider.php (renamed from phpBB/includes/style/extension_path_provider.php)0
-rw-r--r--phpBB/phpbb/style/path_provider.php (renamed from phpBB/includes/style/path_provider.php)0
-rw-r--r--phpBB/phpbb/style/path_provider_interface.php (renamed from phpBB/includes/style/path_provider_interface.php)0
-rw-r--r--phpBB/phpbb/style/resource_locator.php (renamed from phpBB/includes/style/resource_locator.php)0
-rw-r--r--phpBB/phpbb/style/style.php (renamed from phpBB/includes/style/style.php)0
-rw-r--r--phpBB/phpbb/template/asset.php182
-rw-r--r--phpBB/phpbb/template/context.php (renamed from phpBB/includes/template/context.php)0
-rw-r--r--phpBB/phpbb/template/locator.php (renamed from phpBB/includes/template/locator.php)0
-rw-r--r--phpBB/phpbb/template/template.php (renamed from phpBB/includes/template/template.php)0
-rw-r--r--phpBB/phpbb/template/twig/definition.php (renamed from phpBB/includes/template/twig/definition.php)0
-rw-r--r--phpBB/phpbb/template/twig/environment.php (renamed from phpBB/includes/template/twig/environment.php)0
-rw-r--r--phpBB/phpbb/template/twig/extension.php (renamed from phpBB/includes/template/twig/extension.php)0
-rw-r--r--phpBB/phpbb/template/twig/lexer.php (renamed from phpBB/includes/template/twig/lexer.php)21
-rw-r--r--phpBB/phpbb/template/twig/node/define.php (renamed from phpBB/includes/template/twig/node/define.php)0
-rw-r--r--phpBB/phpbb/template/twig/node/event.php (renamed from phpBB/includes/template/twig/node/event.php)0
-rw-r--r--phpBB/phpbb/template/twig/node/expression/binary/equalequal.php (renamed from phpBB/includes/template/twig/node/expression/binary/equalequal.php)0
-rw-r--r--phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php (renamed from phpBB/includes/template/twig/node/expression/binary/notequalequal.php)0
-rw-r--r--phpBB/phpbb/template/twig/node/include.php (renamed from phpBB/includes/template/twig/node/include.php)0
-rw-r--r--phpBB/phpbb/template/twig/node/includeasset.php (renamed from phpBB/includes/template/twig/node/includeasset.php)23
-rw-r--r--phpBB/phpbb/template/twig/node/includecss.php (renamed from phpBB/includes/template/twig/node/includecss.php)0
-rw-r--r--phpBB/phpbb/template/twig/node/includejs.php (renamed from phpBB/includes/template/twig/node/includejs.php)0
-rw-r--r--phpBB/phpbb/template/twig/node/includephp.php (renamed from phpBB/includes/template/twig/node/includephp.php)0
-rw-r--r--phpBB/phpbb/template/twig/node/php.php (renamed from phpBB/includes/template/twig/node/php.php)0
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/define.php (renamed from phpBB/includes/template/twig/tokenparser/define.php)0
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/event.php (renamed from phpBB/includes/template/twig/tokenparser/event.php)0
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/include.php (renamed from phpBB/includes/template/twig/tokenparser/include.php)0
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includecss.php (renamed from phpBB/includes/template/twig/tokenparser/includecss.php)0
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includejs.php (renamed from phpBB/includes/template/twig/tokenparser/includejs.php)0
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includephp.php (renamed from phpBB/includes/template/twig/tokenparser/includephp.php)0
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/php.php (renamed from phpBB/includes/template/twig/tokenparser/php.php)0
-rw-r--r--phpBB/phpbb/template/twig/twig.php (renamed from phpBB/includes/template/twig/twig.php)2
-rw-r--r--phpBB/phpbb/tree/interface.php (renamed from phpBB/includes/tree/interface.php)0
-rw-r--r--phpBB/phpbb/tree/nestedset.php (renamed from phpBB/includes/tree/nestedset.php)0
-rw-r--r--phpBB/phpbb/tree/nestedset_forum.php (renamed from phpBB/includes/tree/nestedset_forum.php)0
-rw-r--r--phpBB/phpbb/user.php (renamed from phpBB/includes/user.php)0
-rw-r--r--phpBB/phpbb/user_loader.php (renamed from phpBB/includes/user_loader.php)0
-rw-r--r--phpBB/posting.php140
-rw-r--r--phpBB/report.php11
-rw-r--r--phpBB/search.php62
-rw-r--r--phpBB/styles/prosilver/template/ajax.js34
-rw-r--r--phpBB/styles/prosilver/template/confirm_delete_body.html72
-rw-r--r--phpBB/styles/prosilver/template/editor.js2
-rw-r--r--phpBB/styles/prosilver/template/forum_fn.js78
-rw-r--r--phpBB/styles/prosilver/template/forumlist_body.html6
-rw-r--r--phpBB/styles/prosilver/template/index_body.html11
-rw-r--r--phpBB/styles/prosilver/template/mcp_approve.html4
-rw-r--r--phpBB/styles/prosilver/template/mcp_forum.html2
-rw-r--r--phpBB/styles/prosilver/template/mcp_post.html18
-rw-r--r--phpBB/styles/prosilver/template/mcp_queue.html29
-rw-r--r--phpBB/styles/prosilver/template/mcp_topic.html27
-rw-r--r--phpBB/styles/prosilver/template/overall_footer.html23
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html15
-rw-r--r--phpBB/styles/prosilver/template/posting_buttons.html3
-rw-r--r--phpBB/styles/prosilver/template/posting_editor.html27
-rw-r--r--phpBB/styles/prosilver/template/posting_layout.html7
-rw-r--r--phpBB/styles/prosilver/template/search_results.html1
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html1
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html55
-rw-r--r--phpBB/styles/prosilver/theme/buttons.css14
-rw-r--r--phpBB/styles/prosilver/theme/common.css36
-rw-r--r--phpBB/styles/prosilver/theme/images/icon_topic_deleted.pngbin0 -> 1205 bytes
-rw-r--r--phpBB/styles/prosilver/theme/imageset.css5
-rw-r--r--phpBB/styles/subsilver2/template/confirm_delete_body.html56
-rw-r--r--phpBB/styles/subsilver2/template/forumlist_body.html9
-rw-r--r--phpBB/styles/subsilver2/template/mcp_approve.html2
-rw-r--r--phpBB/styles/subsilver2/template/mcp_forum.html4
-rw-r--r--phpBB/styles/subsilver2/template/mcp_post.html7
-rw-r--r--phpBB/styles/subsilver2/template/mcp_queue.html38
-rw-r--r--phpBB/styles/subsilver2/template/mcp_topic.html2
-rw-r--r--phpBB/styles/subsilver2/template/posting_body.html29
-rw-r--r--phpBB/styles/subsilver2/template/search_results.html3
-rw-r--r--phpBB/styles/subsilver2/template/viewforum_body.html8
-rw-r--r--phpBB/styles/subsilver2/template/viewtopic_body.html40
-rw-r--r--phpBB/styles/subsilver2/theme/images/icon_topic_deleted.pngbin0 -> 1205 bytes
-rw-r--r--phpBB/styles/subsilver2/theme/stylesheet.css5
-rw-r--r--phpBB/ucp.php13
-rw-r--r--phpBB/viewforum.php29
-rw-r--r--phpBB/viewtopic.php128
-rw-r--r--phpunit.xml.all9
-rw-r--r--phpunit.xml.dist9
-rw-r--r--phpunit.xml.functional9
-rw-r--r--tests/acp_board/auth_provider/invalid.php13
-rw-r--r--tests/acp_board/auth_provider/valid.php16
-rw-r--r--tests/acp_board/select_auth_method_test.php48
-rw-r--r--tests/avatar/manager_test.php130
-rw-r--r--tests/bootstrap.php4
-rw-r--r--tests/class_loader/class_loader_test.php10
-rw-r--r--tests/class_loader/phpbb/class_name.php (renamed from tests/class_loader/includes/class_name.php)0
-rw-r--r--tests/class_loader/phpbb/dir.php (renamed from tests/class_loader/includes/dir.php)0
-rw-r--r--tests/class_loader/phpbb/dir/class_name.php (renamed from tests/class_loader/includes/dir/class_name.php)0
-rw-r--r--tests/class_loader/phpbb/dir/subdir/class_name.php (renamed from tests/class_loader/includes/dir/subdir/class_name.php)0
-rw-r--r--tests/class_loader/phpbb/dir2/dir2.php (renamed from tests/class_loader/includes/dir2/dir2.php)0
-rw-r--r--tests/content_visibility/delete_post_test.php310
-rw-r--r--tests/content_visibility/fixtures/delete_post.xml167
-rw-r--r--tests/content_visibility/fixtures/get_forums_visibility_sql.xml133
-rw-r--r--tests/content_visibility/fixtures/get_visibility_sql.xml55
-rw-r--r--tests/content_visibility/fixtures/set_post_visibility.xml162
-rw-r--r--tests/content_visibility/fixtures/set_topic_visibility.xml136
-rw-r--r--tests/content_visibility/get_forums_visibility_sql_test.php143
-rw-r--r--tests/content_visibility/get_global_visibility_sql_test.php143
-rw-r--r--tests/content_visibility/get_visibility_sql_test.php90
-rw-r--r--tests/content_visibility/set_post_visibility_test.php143
-rw-r--r--tests/content_visibility/set_topic_visibility_test.php107
-rw-r--r--tests/controller/controller_test.php2
-rw-r--r--tests/controller/phpbb/controller/foo.php (renamed from tests/controller/includes/controller/foo.php)0
-rw-r--r--tests/datetime/from_format_test.php3
-rw-r--r--tests/dbal/auto_increment_test.php1
-rw-r--r--tests/dbal/db_tools_test.php1
-rw-r--r--tests/dbal/migrator_test.php4
-rw-r--r--tests/dbal/migrator_tool_config_test.php3
-rw-r--r--tests/dbal/migrator_tool_module_test.php2
-rw-r--r--tests/dbal/migrator_tool_permission_test.php2
-rw-r--r--tests/error_collector_test.php1
-rw-r--r--tests/extension/finder_test.php8
-rw-r--r--tests/extension/metadata_manager_test.php2
-rw-r--r--tests/extension/phpbb/default/implementation.php (renamed from tests/extension/includes/default/implementation.php)0
-rw-r--r--tests/functional/auth_test.php1
-rw-r--r--tests/functional/avatar_acp_groups_test.php63
-rw-r--r--tests/functional/avatar_acp_users_test.php61
-rw-r--r--tests/functional/avatar_ucp_groups_test.php71
-rw-r--r--tests/functional/avatar_ucp_users_test.php78
-rw-r--r--tests/functional/browse_test.php7
-rw-r--r--tests/functional/common_avatar_test.php80
-rw-r--r--tests/functional/common_groups_test.php50
-rw-r--r--tests/functional/extension_controller_test.php1
-rw-r--r--tests/functional/extension_module_test.php2
-rw-r--r--tests/functional/extension_permission_lang_test.php3
-rw-r--r--tests/functional/fixtures/ext/foo/bar/event/permission_listener.php40
-rw-r--r--tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php3
-rw-r--r--tests/functional/metadata_manager_test.php2
-rw-r--r--tests/functional/report_post_captcha_test.php (renamed from tests/functional/report_post_captcha.php)19
-rw-r--r--tests/functional/softdelete_test.php761
-rw-r--r--tests/functional/ucp_groups_test.php49
-rw-r--r--tests/log/function_view_log_test.php1
-rw-r--r--tests/mock/auth_provider.php53
-rw-r--r--tests/mock/search.php23
-rw-r--r--tests/mock/session_testable.php4
-rw-r--r--tests/mock/sql_insert_buffer.php21
-rw-r--r--tests/notification/convert_test.php108
-rw-r--r--tests/notification/fixtures/convert.xml80
-rw-r--r--tests/notification/submit_post_base.php1
-rw-r--r--tests/session/check_ban_test.php78
-rw-r--r--tests/session/check_isvalid_test.php61
-rw-r--r--tests/session/continue_test.php133
-rw-r--r--tests/session/create_test.php43
-rw-r--r--tests/session/creation_test.php69
-rw-r--r--tests/session/extract_hostname_test.php51
-rw-r--r--tests/session/extract_page_test.php115
-rw-r--r--tests/session/fixtures/sessions_banlist.xml66
-rw-r--r--tests/session/fixtures/sessions_full.xml3
-rw-r--r--tests/session/fixtures/sessions_garbage.xml58
-rw-r--r--tests/session/fixtures/sessions_key.xml44
-rw-r--r--tests/session/garbage_collection_test.php53
-rw-r--r--tests/session/session_key_test.php51
-rw-r--r--tests/session/testable_facade.php142
-rw-r--r--tests/session/testable_factory.php40
-rw-r--r--tests/session/unset_admin_test.php48
-rw-r--r--tests/session/validate_referrer_test.php70
-rw-r--r--tests/template/template_includejs_test.php26
-rw-r--r--tests/template/template_parser_test.php29
-rw-r--r--tests/template/template_test.php2
-rw-r--r--tests/template/templates/define.html7
-rw-r--r--tests/template/templates/includejs.html8
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php76
-rw-r--r--tests/test_framework/phpbb_session_test_case.php36
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php3
-rw-r--r--tests/upload/fileupload_test.php1
-rw-r--r--travis/phpunit-mysql-travis.xml4
-rw-r--r--travis/phpunit-postgres-travis.xml1
465 files changed, 9519 insertions, 2533 deletions
diff --git a/build/build.xml b/build/build.xml
index 02518ac441..f8181160c1 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -169,26 +169,42 @@
command="git archive ${revision} | tar -xf - -C ../${dir}"
checkreturn="true" />
- <!--
- If composer.phar exists in this version of the tree, also export
- it into ${dir}, install dependencies, then delete it again.
- -->
- <exec dir="."
- command="git ls-tree ${revision} composer.phar"
+ <!-- Install composer dependencies, if there are any. -->
+ <exec dir="${dir}"
+ command='php -r "\$j = json_decode(file_get_contents(\"composer.json\")); echo isset(\$j->require);"'
checkreturn="true"
- outputProperty='composer-ls-tree-output' />
+ outputProperty='composer-has-dependencies' />
<if>
- <not><equals arg1="${composer-ls-tree-output}" arg2="" trim="true" /></not>
+ <equals arg1="${composer-has-dependencies}" arg2="1" trim="true" />
<then>
+ <!-- We have non-dev composer dependencies -->
<exec dir="."
- command="git archive ${revision} composer.phar | tar -xf - -C ${dir}"
- checkreturn="true" />
- <exec dir="${dir}"
- command="php composer.phar install"
+ command="git ls-tree ${revision} composer.phar"
checkreturn="true"
- passthru="true" />
- <delete file="${dir}/composer.phar" />
+ outputProperty='composer-ls-tree-output' />
+ <if>
+ <equals arg1="${composer-ls-tree-output}" arg2="" trim="true" />
+ <then>
+ <fail message="There are composer dependencies, but composer.phar is missing." />
+ </then>
+ <else>
+ <!-- Export the phar, install dependencies, delete phar. -->
+ <exec dir="."
+ command="git archive ${revision} composer.phar | tar -xf - -C ${dir}"
+ checkreturn="true" />
+ <exec dir="${dir}"
+ command="php composer.phar install"
+ checkreturn="true"
+ passthru="true" />
+ <delete file="${dir}/composer.phar" />
+ </else>
+ </if>
</then>
+ <else>
+ <!-- We do not have composer dependencies, do not ship composer files -->
+ <delete file="${dir}/composer.json" />
+ <delete file="${dir}/composer.lock" />
+ </else>
</if>
<delete file="${dir}/config.php" />
diff --git a/phpBB/adm/style/acp_board.html b/phpBB/adm/style/acp_board.html
index 6b8ceb3ef6..1a09c4eee6 100644
--- a/phpBB/adm/style/acp_board.html
+++ b/phpBB/adm/style/acp_board.html
@@ -34,7 +34,7 @@
<!-- IF S_AUTH -->
<!-- BEGIN auth_tpl -->
- {auth_tpl.TPL}
+ <!-- INCLUDE {auth_tpl.TEMPLATE_FILE} -->
<!-- END auth_tpl -->
<!-- ENDIF -->
diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js
index 6f21dfa6ac..efb0639f1b 100644
--- a/phpBB/adm/style/ajax.js
+++ b/phpBB/adm/style/ajax.js
@@ -127,8 +127,10 @@ phpbb.addAjaxCallback('activate_deactivate', function(res) {
* The removes the parent row of the link or form that triggered the callback,
* and is good for stuff like the removal of forums.
*/
-phpbb.addAjaxCallback('row_delete', function() {
- $(this).parents('tr').remove();
+phpbb.addAjaxCallback('row_delete', function(res) {
+ if (res.SUCCESS !== false) {
+ $(this).parents('tr').remove();
+ }
});
diff --git a/phpBB/adm/style/auth_provider_ldap.html b/phpBB/adm/style/auth_provider_ldap.html
new file mode 100644
index 0000000000..81afa44373
--- /dev/null
+++ b/phpBB/adm/style/auth_provider_ldap.html
@@ -0,0 +1,32 @@
+<dl>
+ <dt><label for="ldap_server">{L_LDAP_SERVER}{L_COLON}</label><br /><span>{L_LDAP_SERVER_EXPLAIN}</span></dt>
+ <dd><input type="text" id="ldap_server" size="40" name="config[ldap_server]" value="{AUTH_LDAP_SERVER}" /></dd>
+</dl>
+<dl>
+ <dt><label for="ldap_port">{L_LDAP_PORT}{L_COLON}</label><br /><span>{L_LDAP_PORT_EXPLAIN}</span></dt>
+ <dd><input type="text" id="ldap_port" size="40" name="config[ldap_port]" value="{AUTH_LDAP_PORT}" /></dd>
+</dl>
+<dl>
+ <dt><label for="ldap_dn">{L_LDAP_DN}{L_COLON}</label><br /><span>{L_LDAP_DN_EXPLAIN}</span></dt>
+ <dd><input type="text" id="ldap_dn" size="40" name="config[ldap_base_dn]" value="{AUTH_LDAP_BASE_DN}" /></dd>
+</dl>
+<dl>
+ <dt><label for="ldap_uid">{L_LDAP_UID}{L_COLON}</label><br /><span>{L_LDAP_UID_EXPLAIN}</span></dt>
+ <dd><input type="text" id="ldap_uid" size="40" name="config[ldap_uid]" value="{AUTH_LDAP_UID}" /></dd>
+</dl>
+<dl>
+ <dt><label for="ldap_user_filter">{L_LDAP_USER_FILTER}{L_COLON}</label><br /><span>{L_LDAP_USER_FILTER_EXPLAIN}</span></dt>
+ <dd><input type="text" id="ldap_user_filter" size="40" name="config[ldap_user_filter]" value="{AUTH_LDAP_USER_FILTER}" /></dd>
+</dl>
+<dl>
+ <dt><label for="ldap_email">{L_LDAP_EMAIL}{L_COLON}</label><br /><span>{L_LDAP_EMAIL_EXPLAIN}</span></dt>
+ <dd><input type="email" id="ldap_email" size="40" name="config[ldap_email]" value="{AUTH_LDAP_EMAIL}" /></dd>
+</dl>
+<dl>
+ <dt><label for="ldap_user">{L_LDAP_USER}{L_COLON}</label><br /><span>{L_LDAP_USER_EXPLAIN}</span></dt>
+ <dd><input type="text" id="ldap_user" size="40" name="config[ldap_user]" value="{AUTH_LDAP_USER}" /></dd>
+</dl>
+<dl>
+ <dt><label for="ldap_password">{L_LDAP_PASSWORD}{L_COLON}</label><br /><span>{L_LDAP_PASSWORD_EXPLAIN}</span></dt>
+ <dd><input type="password" id="ldap_password" size="40" name="config[ldap_password]" value="{AUTH_LDAP_PASSWORD}" autocomplete="off" /></dd>
+</dl>
diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html
index 54ed4dcc9e..9202cec06b 100644
--- a/phpBB/adm/style/overall_footer.html
+++ b/phpBB/adm/style/overall_footer.html
@@ -38,7 +38,7 @@
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script>
<!-- INCLUDEJS ajax.js -->
-{SCRIPTS}
+{$SCRIPTS}
<!-- EVENT acp_overall_footer_after -->
diff --git a/phpBB/adm/style/permission_roles_mask.html b/phpBB/adm/style/permission_roles_mask.html
index 277310edbf..42a7fc3e4e 100644
--- a/phpBB/adm/style/permission_roles_mask.html
+++ b/phpBB/adm/style/permission_roles_mask.html
@@ -25,7 +25,7 @@
<a href="{role_mask.groups.U_PROFILE}">{role_mask.groups.GROUP_NAME}</a><!-- IF not role_mask.groups.S_LAST_ROW --> :: <!-- ENDIF -->
<!-- BEGINELSE -->
{L_GROUPS_NOT_ASSIGNED}
- <!-- END users -->
+ <!-- END groups -->
</td>
</tr>
</tbody>
diff --git a/phpBB/common.php b/phpBB/common.php
index f6f109c3de..962a1f951f 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -46,7 +46,7 @@ if (!defined('PHPBB_INSTALLED'))
$script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
// Eliminate . and .. from the path
- require($phpbb_root_path . 'includes/filesystem.' . $phpEx);
+ require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
$phpbb_filesystem = new phpbb_filesystem();
$script_path = $phpbb_filesystem->clean_path($script_path);
@@ -71,7 +71,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
// Include files
-require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
+require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
@@ -85,7 +85,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Setup class loader first
-$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
+$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
diff --git a/phpBB/composer.json b/phpBB/composer.json
index a114d5c0e0..bf693d1950 100644
--- a/phpBB/composer.json
+++ b/phpBB/composer.json
@@ -12,6 +12,7 @@
"require-dev": {
"fabpot/goutte": "v0.1.0",
"phpunit/dbunit": "1.2.*",
- "phpunit/phpunit": "3.7.*"
+ "phpunit/phpunit": "3.7.*",
+ "phing/phing": "2.4.*"
}
}
diff --git a/phpBB/composer.lock b/phpBB/composer.lock
index a20c6303ee..1ba6cb6f83 100644
--- a/phpBB/composer.lock
+++ b/phpBB/composer.lock
@@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "e4a4f4848a7201d7e044446001afda29",
+ "hash": "6e6125b88160e28568edcb9fd007abed",
"packages": [
{
"name": "symfony/config",
@@ -29,6 +29,7 @@
"Symfony\\Component\\Config": ""
}
},
+ "notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -78,6 +79,7 @@
"Symfony\\Component\\DependencyInjection": ""
}
},
+ "notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -126,6 +128,7 @@
"Symfony\\Component\\EventDispatcher": ""
}
},
+ "notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -168,6 +171,7 @@
"SessionHandlerInterface": "Symfony/Component/HttpFoundation/Resources/stubs"
}
},
+ "notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -229,6 +233,7 @@
"Symfony\\Component\\HttpKernel": ""
}
},
+ "notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -281,6 +286,7 @@
"Symfony\\Component\\Routing": ""
}
},
+ "notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -322,6 +328,7 @@
"Symfony\\Component\\Yaml": ""
}
},
+ "notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -367,6 +374,7 @@
"Twig_": "lib/"
}
},
+ "notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3"
],
@@ -534,6 +542,58 @@
"time": "2012-12-19 23:06:35"
},
{
+ "name": "phing/phing",
+ "version": "2.4.14",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phingofficial/phing",
+ "reference": "2.4.14"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://github.com/phingofficial/phing/archive/2.4.14.zip",
+ "reference": "2.4.14",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.2.0"
+ },
+ "bin": [
+ "bin/phing"
+ ],
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "classes/phing/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "include-path": [
+ "classes"
+ ],
+ "license": [
+ "LGPL3"
+ ],
+ "authors": [
+ {
+ "name": "Michiel Rook",
+ "email": "mrook@php.net"
+ },
+ {
+ "name": "Phing Community",
+ "homepage": "http://www.phing.info/trac/wiki/Development/Contributors"
+ }
+ ],
+ "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.",
+ "homepage": "http://www.phing.info/",
+ "keywords": [
+ "build",
+ "task",
+ "tool"
+ ],
+ "time": "2012-11-29 21:23:47"
+ },
+ {
"name": "phpunit/dbunit",
"version": "1.2.3",
"source": {
@@ -593,16 +653,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "1.2.11",
+ "version": "1.2.12",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "1.2.11"
+ "reference": "1.2.12"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.11",
- "reference": "1.2.11",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.12",
+ "reference": "1.2.12",
"shasum": ""
},
"require": {
@@ -612,13 +672,18 @@
"phpunit/php-token-stream": ">=1.1.3@stable"
},
"require-dev": {
- "phpunit/phpunit": "3.7.*"
+ "phpunit/phpunit": "3.7.*@dev"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.0.5"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
"autoload": {
"classmap": [
"PHP/"
@@ -645,7 +710,7 @@
"testing",
"xunit"
],
- "time": "2013-05-23 18:23:24"
+ "time": "2013-07-06 06:26:16"
},
{
"name": "phpunit/php-file-iterator",
@@ -827,16 +892,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "3.7.21",
+ "version": "3.7.22",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "3.7.21"
+ "reference": "3.7.22"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.21",
- "reference": "3.7.21",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.22",
+ "reference": "3.7.22",
"shasum": ""
},
"require": {
@@ -845,12 +910,12 @@
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
- "phpunit/php-code-coverage": ">=1.2.1,<1.3.0",
+ "phpunit/php-code-coverage": "~1.2.1",
"phpunit/php-file-iterator": ">=1.3.1",
"phpunit/php-text-template": ">=1.1.1",
- "phpunit/php-timer": ">=1.0.2,<1.1.0",
- "phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0",
- "symfony/yaml": ">=2.0,<3.0"
+ "phpunit/php-timer": "~1.0.2",
+ "phpunit/phpunit-mock-objects": "~1.2.0",
+ "symfony/yaml": "~2.0"
},
"require-dev": {
"pear-pear/pear": "1.9.4"
@@ -897,7 +962,7 @@
"testing",
"xunit"
],
- "time": "2013-05-23 18:54:29"
+ "time": "2013-07-06 06:29:15"
},
{
"name": "phpunit/phpunit-mock-objects",
diff --git a/phpBB/config/feed.yml b/phpBB/config/feed.yml
index 59eeafd458..5a4cdae815 100644
--- a/phpBB/config/feed.yml
+++ b/phpBB/config/feed.yml
@@ -23,6 +23,7 @@ services:
- @cache.driver
- @user
- @auth
+ - @content.visibility
- %core.php_ext%
feed.forums:
@@ -35,6 +36,7 @@ services:
- @cache.driver
- @user
- @auth
+ - @content.visibility
- %core.php_ext%
feed.news:
@@ -47,6 +49,7 @@ services:
- @cache.driver
- @user
- @auth
+ - @content.visibility
- %core.php_ext%
feed.overall:
@@ -59,6 +62,7 @@ services:
- @cache.driver
- @user
- @auth
+ - @content.visibility
- %core.php_ext%
feed.topic:
@@ -71,6 +75,7 @@ services:
- @cache.driver
- @user
- @auth
+ - @content.visibility
- %core.php_ext%
feed.topics:
@@ -83,6 +88,7 @@ services:
- @cache.driver
- @user
- @auth
+ - @content.visibility
- %core.php_ext%
feed.topics_active:
@@ -95,4 +101,5 @@ services:
- @cache.driver
- @user
- @auth
+ - @content.visibility
- %core.php_ext%
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index e228b3d83f..8abc413a5a 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -8,6 +8,12 @@ imports:
- { resource: auth_providers.yml }
services:
+ acl.permissions:
+ class: phpbb_permissions
+ arguments:
+ - @dispatcher
+ - @user
+
auth:
class: phpbb_auth
@@ -66,6 +72,19 @@ services:
- @dbal.conn
- %tables.config_text%
+ content.visibility:
+ class: phpbb_content_visibility
+ arguments:
+ - @auth
+ - @dbal.conn
+ - @user
+ - %core.root_path%
+ - %core.php_ext%
+ - %tables.forums%
+ - %tables.posts%
+ - %tables.topics%
+ - %tables.users%
+
controller.helper:
class: phpbb_controller_helper
arguments:
@@ -113,7 +132,6 @@ services:
- [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]]
dbal.tools:
- file: %core.root_path%includes/db/db_tools.%core.php_ext%
class: phpbb_db_tools
arguments:
- @dbal.conn
@@ -227,6 +245,9 @@ services:
- %tables.notifications%
- %tables.user_notifications%
+ php_ini:
+ class: phpbb_php_ini
+
request:
class: phpbb_request
diff --git a/phpBB/config/tables.yml b/phpBB/config/tables.yml
index ec5fec23ad..fdb448f4e0 100644
--- a/phpBB/config/tables.yml
+++ b/phpBB/config/tables.yml
@@ -2,10 +2,13 @@ parameters:
tables.config: %core.table_prefix%config
tables.config_text: %core.table_prefix%config_text
tables.ext: %core.table_prefix%ext
+ tables.forums: %core.table_prefix%forums
tables.log: %core.table_prefix%log
tables.migrations: %core.table_prefix%migrations
tables.modules: %core.table_prefix%modules
tables.notification_types: %core.table_prefix%notification_types
tables.notifications: %core.table_prefix%notifications
+ tables.posts: %core.table_prefix%posts
+ tables.topics: %core.table_prefix%topics
tables.user_notifications: %core.table_prefix%user_notifications
tables.users: %core.table_prefix%users
diff --git a/phpBB/develop/benchmark.php b/phpBB/develop/benchmark.php
index c867b9262e..c653fdaa24 100644
--- a/phpBB/develop/benchmark.php
+++ b/phpBB/develop/benchmark.php
@@ -192,13 +192,13 @@ function get_topic_count($forum_id)
{
global $db;
- $sql = "SELECT forum_topics
+ $sql = "SELECT forum_topics_approved
FROM " . FORUMS_TABLE . "
WHERE (forum_id = $forum_id)";
if($result = $db->sql_query($sql))
{
$row = $db->sql_fetchrow($result);
- $topic_count = $row['forum_topics'];
+ $topic_count = $row['forum_topics_approved'];
unset($result);
unset($row);
@@ -263,7 +263,7 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
$post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
- $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, attach_id, icon_id, post_username, post_time, poster_ip, post_approved, bbcode_uid, enable_bbcode, enable_html, enable_smilies, enable_sig, post_subject, post_text)
+ $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, attach_id, icon_id, post_username, post_time, poster_ip, post_visibility, bbcode_uid, enable_bbcode, enable_html, enable_smilies, enable_sig, post_subject, post_text)
VALUES ($new_topic_id, $forum_id, $user_id, 0, 0, '$post_username', $current_time, '$user_ip', 1, '$bbcode_uid', $bbcode_on, $html_on, $smilies_on, $attach_sig, '$post_subject', '$post_message')";
$result = $db->sql_query($sql);
@@ -282,10 +282,10 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
if($db->sql_query($sql))
{
$sql = "UPDATE " . FORUMS_TABLE . "
- SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
+ SET forum_last_post_id = $new_post_id, forum_posts_approved = forum_posts_approved + 1";
if($mode == "newtopic")
{
- $sql .= ", forum_topics = forum_topics + 1";
+ $sql .= ", forum_topics_approved = forum_topics_approved + 1";
}
$sql .= " WHERE forum_id = $forum_id";
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 0fd1a722ca..316fbe19e6 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -1104,9 +1104,12 @@ function get_schema_struct()
'forum_topics_per_page' => array('TINT:4', 0),
'forum_type' => array('TINT:4', 0),
'forum_status' => array('TINT:4', 0),
- 'forum_posts' => array('UINT', 0),
- 'forum_topics' => array('UINT', 0),
- 'forum_topics_real' => array('UINT', 0),
+ 'forum_posts_approved' => array('UINT', 0),
+ 'forum_posts_unapproved' => array('UINT', 0),
+ 'forum_posts_softdeleted' => array('UINT', 0),
+ 'forum_topics_approved' => array('UINT', 0),
+ 'forum_topics_unapproved' => array('UINT', 0),
+ 'forum_topics_softdeleted' => array('UINT', 0),
'forum_last_post_id' => array('UINT', 0),
'forum_last_poster_id' => array('UINT', 0),
'forum_last_post_subject' => array('STEXT_UNI', ''),
@@ -1381,7 +1384,7 @@ function get_schema_struct()
'icon_id' => array('UINT', 0),
'poster_ip' => array('VCHAR:40', ''),
'post_time' => array('TIMESTAMP', 0),
- 'post_approved' => array('BOOL', 1),
+ 'post_visibility' => array('TINT:3', 0),
'post_reported' => array('BOOL', 0),
'enable_bbcode' => array('BOOL', 1),
'enable_smilies' => array('BOOL', 1),
@@ -1400,6 +1403,9 @@ function get_schema_struct()
'post_edit_user' => array('UINT', 0),
'post_edit_count' => array('USINT', 0),
'post_edit_locked' => array('BOOL', 0),
+ 'post_delete_time' => array('TIMESTAMP', 0),
+ 'post_delete_reason' => array('STEXT_UNI', ''),
+ 'post_delete_user' => array('UINT', 0),
),
'PRIMARY_KEY' => 'post_id',
'KEYS' => array(
@@ -1407,7 +1413,7 @@ function get_schema_struct()
'topic_id' => array('INDEX', 'topic_id'),
'poster_ip' => array('INDEX', 'poster_ip'),
'poster_id' => array('INDEX', 'poster_id'),
- 'post_approved' => array('INDEX', 'post_approved'),
+ 'post_visibility' => array('INDEX', 'post_visibility'),
'post_username' => array('INDEX', 'post_username'),
'tid_post_time' => array('INDEX', array('topic_id', 'post_time')),
),
@@ -1739,15 +1745,16 @@ function get_schema_struct()
'forum_id' => array('UINT', 0),
'icon_id' => array('UINT', 0),
'topic_attachment' => array('BOOL', 0),
- 'topic_approved' => array('BOOL', 1),
+ 'topic_visibility' => array('TINT:3', 0),
'topic_reported' => array('BOOL', 0),
'topic_title' => array('STEXT_UNI', '', 'true_sort'),
'topic_poster' => array('UINT', 0),
'topic_time' => array('TIMESTAMP', 0),
'topic_time_limit' => array('TIMESTAMP', 0),
'topic_views' => array('UINT', 0),
- 'topic_replies' => array('UINT', 0),
- 'topic_replies_real' => array('UINT', 0),
+ 'topic_posts_approved' => array('UINT', 0),
+ 'topic_posts_unapproved' => array('UINT', 0),
+ 'topic_posts_softdeleted' => array('UINT', 0),
'topic_status' => array('TINT:3', 0),
'topic_type' => array('TINT:3', 0),
'topic_first_post_id' => array('UINT', 0),
@@ -1769,14 +1776,17 @@ function get_schema_struct()
'poll_max_options' => array('TINT:4', 1),
'poll_last_vote' => array('TIMESTAMP', 0),
'poll_vote_change' => array('BOOL', 0),
+ 'topic_delete_time' => array('TIMESTAMP', 0),
+ 'topic_delete_reason' => array('STEXT_UNI', ''),
+ 'topic_delete_user' => array('UINT', 0),
),
'PRIMARY_KEY' => 'topic_id',
'KEYS' => array(
'forum_id' => array('INDEX', 'forum_id'),
'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')),
'last_post_time' => array('INDEX', 'topic_last_post_time'),
- 'topic_approved' => array('INDEX', 'topic_approved'),
- 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_approved', 'topic_last_post_id')),
+ 'topic_visibility' => array('INDEX', 'topic_visibility'),
+ 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_visibility', 'topic_last_post_id')),
'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')),
),
);
diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php
index e3b986e163..696b1e31c0 100644
--- a/phpBB/develop/fill.php
+++ b/phpBB/develop/fill.php
@@ -86,7 +86,7 @@ switch ($mode)
$topic_rows[] = "($topic_id, $forum_id, '$forum_id-$topic_id', " . (($topic_id % 34) ? '0' : '1') . ')';
- $sql = 'INSERT IGNORE INTO ' . POSTS_TABLE . ' (topic_id, forum_id, poster_id, post_subject, post_text, post_username, post_approved, post_time, post_reported)
+ $sql = 'INSERT IGNORE INTO ' . POSTS_TABLE . ' (topic_id, forum_id, poster_id, post_subject, post_text, post_username, post_visibility, post_time, post_reported)
VALUES ';
$rows = array();
diff --git a/phpBB/develop/merge_post_tables.php b/phpBB/develop/merge_post_tables.php
index 8edc330a0a..d687a292f2 100644
--- a/phpBB/develop/merge_post_tables.php
+++ b/phpBB/develop/merge_post_tables.php
@@ -50,7 +50,7 @@ switch ($db->sql_layer)
ADD PRIMARY KEY (post_id),
ADD INDEX topic_id (topic_id),
ADD INDEX poster_ip (poster_ip),
- ADD INDEX post_approved (post_approved),
+ ADD INDEX post_visibility (post_visibility),
MODIFY COLUMN post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
ADD COLUMN post_encoding varchar(11) DEFAULT \'iso-8859-15\' NOT NULL';
break;
@@ -162,7 +162,7 @@ while ($row = $db->sql_fetchrow($result))
$forum_id = $row['forum_id'];
$sql_ary[] = "UPDATE " . $table_prefix . "forums
- SET forum_last_poster_id = " . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? $row['user_id'] : ANONYMOUS) . ", forum_last_poster_name = '" . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? addslashes($row['username']) : addslashes($row['post_username'])) . "', forum_last_post_time = " . $row['post_time'] . ", forum_posts = " . (($post_count[$forum_id]) ? $post_count[$forum_id] : 0) . ", forum_topics = " . (($topic_count[$forum_id]) ? $topic_count[$forum_id] : 0) . "
+ SET forum_last_poster_id = " . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? $row['user_id'] : ANONYMOUS) . ", forum_last_poster_name = '" . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? addslashes($row['username']) : addslashes($row['post_username'])) . "', forum_last_post_time = " . $row['post_time'] . ", forum_posts_approved = " . (($post_count[$forum_id]) ? $post_count[$forum_id] : 0) . ", forum_topics_approved = " . (($topic_count[$forum_id]) ? $topic_count[$forum_id] : 0) . "
WHERE forum_id = $forum_id";
$sql = "SELECT t.topic_id, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php
index 7f82ebfeab..597dd5e932 100644
--- a/phpBB/develop/mysql_upgrader.php
+++ b/phpBB/develop/mysql_upgrader.php
@@ -552,9 +552,12 @@ function get_schema_struct()
'forum_topics_per_page' => array('TINT:4', 0),
'forum_type' => array('TINT:4', 0),
'forum_status' => array('TINT:4', 0),
- 'forum_posts' => array('UINT', 0),
- 'forum_topics' => array('UINT', 0),
- 'forum_topics_real' => array('UINT', 0),
+ 'forum_posts_approved' => array('UINT', 0),
+ 'forum_posts_unapproved' => array('UINT', 0),
+ 'forum_posts_softdeleted' => array('UINT', 0),
+ 'forum_topics_approved' => array('UINT', 0),
+ 'forum_topics_unapproved' => array('UINT', 0),
+ 'forum_topics_softdeleted' => array('UINT', 0),
'forum_last_post_id' => array('UINT', 0),
'forum_last_poster_id' => array('UINT', 0),
'forum_last_post_subject' => array('STEXT_UNI', ''),
@@ -768,7 +771,7 @@ function get_schema_struct()
'icon_id' => array('UINT', 0),
'poster_ip' => array('VCHAR:40', ''),
'post_time' => array('TIMESTAMP', 0),
- 'post_approved' => array('BOOL', 1),
+ 'post_visibility' => array('TINT:3', 0),
'post_reported' => array('BOOL', 0),
'enable_bbcode' => array('BOOL', 1),
'enable_smilies' => array('BOOL', 1),
@@ -794,7 +797,7 @@ function get_schema_struct()
'topic_id' => array('INDEX', 'topic_id'),
'poster_ip' => array('INDEX', 'poster_ip'),
'poster_id' => array('INDEX', 'poster_id'),
- 'post_approved' => array('INDEX', 'post_approved'),
+ 'post_visibility' => array('INDEX', 'post_visibility'),
'post_username' => array('INDEX', 'post_username'),
'tid_post_time' => array('INDEX', array('topic_id', 'post_time')),
),
@@ -1107,15 +1110,16 @@ function get_schema_struct()
'forum_id' => array('UINT', 0),
'icon_id' => array('UINT', 0),
'topic_attachment' => array('BOOL', 0),
- 'topic_approved' => array('BOOL', 1),
+ 'topic_visibility' => array('TINT:3', 0),
'topic_reported' => array('BOOL', 0),
'topic_title' => array('STEXT_UNI', '', 'true_sort'),
'topic_poster' => array('UINT', 0),
'topic_time' => array('TIMESTAMP', 0),
'topic_time_limit' => array('TIMESTAMP', 0),
'topic_views' => array('UINT', 0),
- 'topic_replies' => array('UINT', 0),
- 'topic_replies_real' => array('UINT', 0),
+ 'topic_posts_approved' => array('UINT', 0),
+ 'topic_posts_unapproved' => array('UINT', 0),
+ 'topic_posts_softdeleted' => array('UINT', 0),
'topic_status' => array('TINT:3', 0),
'topic_type' => array('TINT:3', 0),
'topic_first_post_id' => array('UINT', 0),
@@ -1143,8 +1147,8 @@ function get_schema_struct()
'forum_id' => array('INDEX', 'forum_id'),
'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')),
'last_post_time' => array('INDEX', 'topic_last_post_time'),
- 'topic_approved' => array('INDEX', 'topic_approved'),
- 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_approved', 'topic_last_post_id')),
+ 'topic_visibility' => array('INDEX', 'topic_visibility'),
+ 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_visibility', 'topic_last_post_id')),
'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')),
),
);
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 942912a593..97f8c40383 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -46,6 +46,7 @@
<ol>
<li><a href="#changelog">Changelog</a>
<ol style="list-style-type: lower-roman;">
+ <li><a href="#v3011">Changes since 3.0.11</a></li>
<li><a href="#v3010">Changes since 3.0.10</a></li>
<li><a href="#v309">Changes since 3.0.9</a></li>
<li><a href="#v308">Changes since 3.0.8</a></li>
@@ -85,7 +86,154 @@
<div class="content">
- <a name="v3010"></a><h3>1.i. Changes since 3.0.10</h3>
+ <a name="v3011"></a><h3>1.i. Changes since 3.0.11</h3>
+
+<h4>Bug</h4>
+<ul>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-6723">PHPBB3-6723</a>] - Empty message in deleted messages in PM history</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-7262">PHPBB3-7262</a>] - Clarify docs about is_dynamic not being updated by set_config()</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8319">PHPBB3-8319</a>] - LOCAL_URL not enforced in bbcodes</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9551">PHPBB3-9551</a>] - Mysql fulltext index creation fails due to partial collation change</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9975">PHPBB3-9975</a>] - Hard coded language in sessions.php</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10184">PHPBB3-10184</a>] - Bots can be sent private messages</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10491">PHPBB3-10491</a>] - Fatal error in functional tests when server returns 404</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10568">PHPBB3-10568</a>] - Modify the trigger language when you edit a PM</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10602">PHPBB3-10602</a>] - A bug in mail queue processing</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10661">PHPBB3-10661</a>] - UCP &gt; PM &gt; Compose &gt; enumerated recipients &gt; BCC group misses a &amp;nbsp; (prosilver)</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10678">PHPBB3-10678</a>] - Provide Firebird, Oracle, and increased MSSQL support in unit tests</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10772">PHPBB3-10772</a>] - trigger_error is using the default style</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10789">PHPBB3-10789</a>] - PM print template (prosilver) with unnecessary variables</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10820">PHPBB3-10820</a>] - Display images directly in IE9 and 10 instead of download</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10828">PHPBB3-10828</a>] - PostgreSQL dbal tests try to connect to the database named as user specified in configuration</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10838">PHPBB3-10838</a>] - Functional tests are not mentioned in RUNNING_TESTS.txt</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10840">PHPBB3-10840</a>] - If you add a member to a group, the form_token can be set to 0 if the creation_time is 0 too. Maybe even if creation_time is unchanged.</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10848">PHPBB3-10848</a>] - Wrong redirect to installer from acp</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10850">PHPBB3-10850</a>] - create_schema_files.php is not creating the oracle or postgres' schema file properly</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10879">PHPBB3-10879</a>] - prosilver: attachment-link will be displayed wrong, when filename is too long </li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10880">PHPBB3-10880</a>] - m_approve should not imply f_noapprove</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10896">PHPBB3-10896</a>] - board_email &amp; board_contact are not validated as email addresses in ACP</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10897">PHPBB3-10897</a>] - Bot Definitions are outdated</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10918">PHPBB3-10918</a>] - docs/INSTALL.html claims there are tar.gz packages</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10943">PHPBB3-10943</a>] - Search Box should display keywords entered by the user</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10967">PHPBB3-10967</a>] - PHPBB_USE_BOARD_URL_PATH not implemented in posting_gen_topic_icons</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10986">PHPBB3-10986</a>] - Invalid email message ids because config variable server_name is used even when force server URL settings is disabled</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10995">PHPBB3-10995</a>] - Return value of $db-&gt;sql_fetchrow() on empty tables is not consistent on mssqlnative</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10996">PHPBB3-10996</a>] - Travis tests fail on Postgres because database does not exist</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11034">PHPBB3-11034</a>] - The functional test case framework does not install a full board each time</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11066">PHPBB3-11066</a>] - MSSQLnative driver contains debug code error_reporting(E_ALL)</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11069">PHPBB3-11069</a>] - missing closing span in subsilver2 simple_footer.html</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11081">PHPBB3-11081</a>] - Duplicated /TD in styles/subsilver2/template/catpcha_qa.html</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11093">PHPBB3-11093</a>] - acp_users_overview.html has a wrongly placed &lt;/dd&gt;</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11094">PHPBB3-11094</a>] - prosilver: searching for users: no textbox for Jabber</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11105">PHPBB3-11105</a>] - Missing mandatory space in meta http-equiv=refresh</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11112">PHPBB3-11112</a>] - phpBB Footer Link should be SSL</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11122">PHPBB3-11122</a>] - Update docs/AUTHORS for 3.0.12-RC1</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11144">PHPBB3-11144</a>] - {FORUM_NAME} is not filled in login mask when logging into a password protected forum</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11145">PHPBB3-11145</a>] - ATTACHED_IMAGE_NOT_IMAGE thrown because of file limit in php.ini</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11158">PHPBB3-11158</a>] - modules table lacks acl_u_sig for signature module</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11159">PHPBB3-11159</a>] - Coding guidelines: static public</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11164">PHPBB3-11164</a>] - Composer not finding symfony/config in PHP 5.3.3</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11178">PHPBB3-11178</a>] - database_update.php should not set error_reporting to E_ALL</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11186">PHPBB3-11186</a>] - Database unit tests fail on windows using sqlite2</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11190">PHPBB3-11190</a>] - Functional tests do not clear the cache between each test</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11196">PHPBB3-11196</a>] - /includes/session.php sends 401 HTTP status with &quot;Not authorized&quot; instead of &quot;Unauthorized&quot;</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11219">PHPBB3-11219</a>] - Database sequences are not updated for tests using fixtures with auto_incremented columns</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11227">PHPBB3-11227</a>] - @return void -&gt; @return null</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11233">PHPBB3-11233</a>] - Anonymous can be selected as a PM recipient</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11248">PHPBB3-11248</a>] - CRLF line endings</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11262">PHPBB3-11262</a>] - .lock files are not in .gitignore</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11265">PHPBB3-11265</a>] - Functional tests do not assert that board installation succeeded</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11269">PHPBB3-11269</a>] - Travis functional test case errors</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11278">PHPBB3-11278</a>] - Firebird tables are not removed correctly on 3.0.9-rc1 update</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11288">PHPBB3-11288</a>] - Search fooled by hyphens</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11291">PHPBB3-11291</a>] - &quot;Could not open input file: ../composer.phar&quot; error during phing's create-package</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11292">PHPBB3-11292</a>] - Newlines removed in display of PM reports, no clickable links in PM reports</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11301">PHPBB3-11301</a>] - &quot;String offset cast occured&quot; error on PHP 5.4</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11304">PHPBB3-11304</a>] - check_form_key breaks in tests when form is submitted in the same second it is retrieved</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11343">PHPBB3-11343</a>] - Loose string comparison during new password activation</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11355">PHPBB3-11355</a>] - Incorrect error message when no user selected for action on group membership management page</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11358">PHPBB3-11358</a>] - Success message even withot selecting a user and performing a group operation</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11361">PHPBB3-11361</a>] - &quot;Array to string conversion&quot; error in $user-&gt;format_date()</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11493">PHPBB3-11493</a>] - Functional tests should fail if any debug output is made</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11517">PHPBB3-11517</a>] - Numbering is wrong in coding guidelines</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11536">PHPBB3-11536</a>] - Installer incorrectly removes /install from script_path</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11537">PHPBB3-11537</a>] - UCP group manage page's error box differs heavily from the rest of the UCP</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11538">PHPBB3-11538</a>] - SQL error on UCP groups manage page caused by setting color to 7 characters long string</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11544">PHPBB3-11544</a>] - Add admin_login() to 3.0 functional test case</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11545">PHPBB3-11545</a>] - is_absolute() should not depend on DIRECTORY_SEPARATOR</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11546">PHPBB3-11546</a>] - is_absolute() throws E_NOTICE for empty string</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11547">PHPBB3-11547</a>] - Test fixtures do not support utf8 characters</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11548">PHPBB3-11548</a>] - Untranslated TOO_SHORT in UCP &quot;Manage Groups&quot;</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11566">PHPBB3-11566</a>] - Reporting a post should require a captcha to be solved by guests</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11568">PHPBB3-11568</a>] - Functional tests fail with retrieving install pages using file_get_contents</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11575">PHPBB3-11575</a>] - phpbb_dbal_order_lower_test::test_cross_join should be called test_order_lower</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11578">PHPBB3-11578</a>] - Missing underscore after function prefix in validate_data()</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11579">PHPBB3-11579</a>] - Add unit tests for validate_data()</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11580">PHPBB3-11580</a>] - Avoid API Limit from composer downloads on github</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11588">PHPBB3-11588</a>] - install/install_update.php should use version.phpbb.com instead of www</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11590">PHPBB3-11590</a>] - Close database connections from tests whenever possible</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11601">PHPBB3-11601</a>] - Allow manual resync of database columns in unit tests not only on fixture load</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11603">PHPBB3-11603</a>] - git-tools use invalid api urls</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11604">PHPBB3-11604</a>] - Functional tests fail when phpBB can not create the config file</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11617">PHPBB3-11617</a>] - Missing U_ACTION in acp_captcha.php</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11618">PHPBB3-11618</a>] - Template tests fail on some systems due to a PHP error in glob()</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11619">PHPBB3-11619</a>] - get_remote_file() should use HTTP 1.0</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11630">PHPBB3-11630</a>] - Improvements to the PHP lint pre-commit hook</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11644">PHPBB3-11644</a>] - Skip phpbb_dbal_order_lower_test on MySQL 5.6</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11662">PHPBB3-11662</a>] - &quot;occured&quot; should be &quot;occurred&quot;</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11670">PHPBB3-11670</a>] - Replace trademark ™ with ® on &quot;Welcome to phpBB&quot; install page</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11674">PHPBB3-11674</a>] - Do not include vendor folder if there are no dependencies.</li>
+</ul>
+<h4>Improvement</h4>
+<ul>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8743">PHPBB3-8743</a>] - New topic / reply notifications do not contain author's name.</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10050">PHPBB3-10050</a>] - subsilver2: Do not show &quot;Mark topics as read&quot; when there are no topics</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10205">PHPBB3-10205</a>] - More informative reporting of errors when database connection fails (MySQL and others)</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10716">PHPBB3-10716</a>] - PHP-parse all php files as part of the test suite</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10841">PHPBB3-10841</a>] - Disable style and language selectors if there's only one installed.</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10854">PHPBB3-10854</a>] - sql server drop default constraint when dropping column </li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10865">PHPBB3-10865</a>] - Updated and Added to docs/INSTALL.html</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10873">PHPBB3-10873</a>] - Change language entry for deleted PMs</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10981">PHPBB3-10981</a>] - Upgrade Goutte and use Composer for Installation</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11131">PHPBB3-11131</a>] - Phrasing &amp; semantics of Board settings</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11162">PHPBB3-11162</a>] - Get rid of $db-&gt;sql_return_on_error(true) trickery when splitting/merging topics</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11192">PHPBB3-11192</a>] - Add Tebibyte to get_formatted_filesize()</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11202">PHPBB3-11202</a>] - Add response status checks to functional tests</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11220">PHPBB3-11220</a>] - Improve tooltip explaining the [list=] - BBcode</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11238">PHPBB3-11238</a>] - Specify goutte version</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11285">PHPBB3-11285</a>] - Use more granularity in dependency checks in compress test</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11293">PHPBB3-11293</a>] - Prefer mysqli over mysql due to php 5.5 alpha 2 deprecating mysql</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11294">PHPBB3-11294</a>] - Update extension list in running tests doc</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11368">PHPBB3-11368</a>] - Latest pm reports row count</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11583">PHPBB3-11583</a>] - InnoDB supports FULLTEXT index since MySQL 5.6.4.</li>
+</ul>
+<h4>Sub-task</h4>
+<ul>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10974">PHPBB3-10974</a>] - Move tests/mock_user.php to tests/mock/user.php</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11009">PHPBB3-11009</a>] - Backport phing build.xml from develop to develop-olympus so it uses composer.</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11540">PHPBB3-11540</a>] - Add unit tests for (phpbb_)is_absolute()</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11541">PHPBB3-11541</a>] - Add unit tests for style_select() in functions.php</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11542">PHPBB3-11542</a>] - Add unit tests for language_select() in functions.php</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11543">PHPBB3-11543</a>] - Add unit tests for obtain online functions in functions.php</li>
+</ul>
+<h4>Task</h4>
+<ul>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10877">PHPBB3-10877</a>] - Have bamboo generate and publish a phpBB package for every build.</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11045">PHPBB3-11045</a>] - Add unit tests for the compress class</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11059">PHPBB3-11059</a>] - Fix README logo</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11060">PHPBB3-11060</a>] - Fix travis.yml pyrus config</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11240">PHPBB3-11240</a>] - Turn on PHPUnit's verbose mode on Travis</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11324">PHPBB3-11324</a>] - Add PHP 5.5 environment on Travis-CI</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11337">PHPBB3-11337</a>] - Run functional tests on Travis CI</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11513">PHPBB3-11513</a>] - Install PHPUnit via Composer's require-dev to simplify test running (no need for pear)</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11526">PHPBB3-11526</a>] - Increase composer minimum-stability from beta to stable</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11527">PHPBB3-11527</a>] - Upgrade composer.phar to 1.0.0-alpha7</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11529">PHPBB3-11529</a>] - Rename RUNNING_TESTS file to .md file to render it on GitHub</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11576">PHPBB3-11576</a>] - Make phpBB Test Suite MySQL behave at least as strict as phpBB MySQL driver</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11671">PHPBB3-11671</a>] - Add phing/phing to composer.json</li>
+</ul>
+
+ <a name="v3010"></a><h3>1.ii. Changes since 3.0.10</h3>
<h4>Bug</h4>
<ul>
@@ -210,7 +358,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10909">PHPBB3-10909</a>] - Update Travis Test Configuration: Travis no longer supports PHP 5.3.2</li>
</ul>
- <a name="v309"></a><h3>1.ii. Changes since 3.0.9</h3>
+ <a name="v309"></a><h3>1.iii. Changes since 3.0.9</h3>
<h4>Bug</h4>
<ul>
@@ -346,7 +494,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10480">PHPBB3-10480</a>] - Automate changelog building</li>
</ul>
- <a name="v308"></a><h3>1.iii. Changes since 3.0.8</h3>
+ <a name="v308"></a><h3>1.iv. Changes since 3.0.8</h3>
<h4> Bug
</h4>
@@ -714,7 +862,7 @@
</ul>
- <a name="v307-PL1"></a><h3>1.iv. Changes since 3.0.7-PL1</h3>
+ <a name="v307-PL1"></a><h3>1.v. Changes since 3.0.7-PL1</h3>
<h4> Security
</h4>
<ul>
@@ -1172,13 +1320,13 @@
</ul>
- <a name="v307"></a><h3>1.iv. Changes since 3.0.7</h3>
+ <a name="v307"></a><h3>1.vi. Changes since 3.0.7</h3>
<ul>
<li>[Sec] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)</li>
</ul>
- <a name="v306"></a><h3>1.vi. Changes since 3.0.6</h3>
+ <a name="v306"></a><h3>1.vii. Changes since 3.0.6</h3>
<ul>
<li>[Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)</li>
@@ -1282,7 +1430,7 @@
</ul>
- <a name="v305"></a><h3>1.vii. Changes since 3.0.5</h3>
+ <a name="v305"></a><h3>1.viii. Changes since 3.0.5</h3>
<ul>
<li>[Fix] Allow whitespaces in avatar gallery names. (Bug #44955)</li>
@@ -1504,7 +1652,7 @@
<li>[Feature] Send anonymous statistical information to phpBB on installation and update (optional).</li>
</ul>
- <a name="v304"></a><h3>1.viii. Changes since 3.0.4</h3>
+ <a name="v304"></a><h3>1.ix. Changes since 3.0.4</h3>
<ul>
<li>[Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)</li>
@@ -1593,7 +1741,7 @@
<li>[Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)</li>
</ul>
- <a name="v303"></a><h3>1.ix. Changes since 3.0.3</h3>
+ <a name="v303"></a><h3>1.x. Changes since 3.0.3</h3>
<ul>
<li>[Fix] Allow mixed-case template directories to be inherited (Bug #36725)</li>
@@ -1625,7 +1773,7 @@
<li>[Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)</li>
</ul>
- <a name="v302"></a><h3>1.x. Changes since 3.0.2</h3>
+ <a name="v302"></a><h3>1.xi. Changes since 3.0.2</h3>
<ul>
<li>[Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)</li>
@@ -1724,7 +1872,7 @@
<li>[Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)</li>
</ul>
- <a name="v301"></a><h3>1.xi. Changes since 3.0.1</h3>
+ <a name="v301"></a><h3>1.xii. Changes since 3.0.1</h3>
<ul>
<li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li>
@@ -1772,7 +1920,7 @@
<li>[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)</li>
</ul>
- <a name="v300"></a><h3>1.xii Changes since 3.0.0</h3>
+ <a name="v300"></a><h3>1.xiii Changes since 3.0.0</h3>
<ul>
<li>[Change] Validate birthdays (Bug #15004)</li>
@@ -1843,7 +1991,7 @@
<li>[Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)</li>
</ul>
- <a name="v30rc8"></a><h3>1.xiii. Changes since 3.0.RC8</h3>
+ <a name="v30rc8"></a><h3>1.xiv. Changes since 3.0.RC8</h3>
<ul>
<li>[Fix] Cleaned usernames contain only single spaces, so &quot;a_name&quot; and &quot;a__name&quot; are treated as the same name (Bug #15634)</li>
@@ -1852,7 +2000,7 @@
<li>[Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)</li>
</ul>
- <a name="v30rc7"></a><h3>1.xiv. Changes since 3.0.RC7</h3>
+ <a name="v30rc7"></a><h3>1.xv. Changes since 3.0.RC7</h3>
<ul>
<li>[Fix] Fixed MSSQL related bug in the update system</li>
@@ -1887,7 +2035,7 @@
<li>[Fix] No duplication of active topics (Bug #15474)</li>
</ul>
- <a name="v30rc6"></a><h3>1.xv. Changes since 3.0.RC6</h3>
+ <a name="v30rc6"></a><h3>1.xvi. Changes since 3.0.RC6</h3>
<ul>
<li>[Fix] Submitting language changes using acp_language (Bug #14736)</li>
@@ -1897,7 +2045,7 @@
<li>[Fix] Able to request new password (Bug #14743)</li>
</ul>
- <a name="v30rc5"></a><h3>1.xvi. Changes since 3.0.RC5</h3>
+ <a name="v30rc5"></a><h3>1.xvii. Changes since 3.0.RC5</h3>
<ul>
<li>[Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.</li>
@@ -1960,7 +2108,7 @@
<li>[Sec] New password hashing mechanism for storing passwords (#i42)</li>
</ul>
- <a name="v30rc4"></a><h3>1.xvii. Changes since 3.0.RC4</h3>
+ <a name="v30rc4"></a><h3>1.xviii. Changes since 3.0.RC4</h3>
<ul>
<li>[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)</li>
@@ -2011,7 +2159,7 @@
<li>[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)</li>
</ul>
- <a name="v30rc3"></a><h3>1.xviii. Changes since 3.0.RC3</h3>
+ <a name="v30rc3"></a><h3>1.xix. Changes since 3.0.RC3</h3>
<ul>
<li>[Fix] Fixing some subsilver2 and prosilver style issues</li>
@@ -2120,7 +2268,7 @@
</ul>
- <a name="v30rc2"></a><h3>1.xviv. Changes since 3.0.RC2</h3>
+ <a name="v30rc2"></a><h3>1.xx. Changes since 3.0.RC2</h3>
<ul>
<li>[Fix] Re-allow searching within the memberlist</li>
@@ -2166,7 +2314,7 @@
</ul>
- <a name="v30rc1"></a><h3>1.xx. Changes since 3.0.RC1</h3>
+ <a name="v30rc1"></a><h3>1.xxi. Changes since 3.0.RC1</h3>
<ul>
<li>[Fix] (X)HTML issues within the templates (Bug #11255, #11255)</li>
@@ -2301,7 +2449,7 @@
<div class="content">
- <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
+ <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
</div>
diff --git a/phpBB/docs/FAQ.html b/phpBB/docs/FAQ.html
index ebc5d06189..a76b6be72a 100644
--- a/phpBB/docs/FAQ.html
+++ b/phpBB/docs/FAQ.html
@@ -82,7 +82,7 @@
<p>There are people, companies (unrelated to your hosting provider), etc. that will install your forum, either for free or for a payment. We do not recommend you make use of these offers. Unless the service is provided by your hosting company you will have to divulge passwords and other sensitive details. If you did not know how to use an ATM would you give a passer-by your bank card and PIN and ask them to show you what to do? No, probably not! The same applies to your hosting account details!</p>
-<p>We think a better solution is for you to carefully read the enclosed documentation, read through our knowledge base at <a href="http://www.phpbb.com/">www.phpbb.com</a> and if necessary ask for help on any thing you get stuck on. However, the decision is yours but please note we may not offer support if we believe you have had the board installed by a third party. In such cases you should direct your questions to that company or person/s.</p>
+<p>We think a better solution is for you to carefully read the enclosed documentation, read through our knowledge base at <a href="https://www.phpbb.com/">www.phpbb.com</a> and if necessary ask for help on any thing you get stuck on. However, the decision is yours but please note we may not offer support if we believe you have had the board installed by a third party. In such cases you should direct your questions to that company or person/s.</p>
</div>
@@ -143,7 +143,7 @@ I want to sue you because i think you host an illegal board!</h2>
<div class="content">
-<p>This error will occur if phpBB cannot send mail. phpBB can send email two ways; using the PHP <code>mail()</code> function or directly via SMTP. Some hosting providers limit the <code>mail()</code> function to prevent its use in spamming, others may rename it or limit its functionality. If the <code>mail()</code> function got renamed, you are able to enter the correct name within the administration control panel. In either case you may need to make use of SMTP. This requires that you have access to such a facility, e.g. your hosting provider may provide one (perhaps requiring specific written authorisation), etc. Please see <a href="http://www.phpbb.com/">www.phpbb.com</a> for additional help on this matter.</p>
+<p>This error will occur if phpBB cannot send mail. phpBB can send email two ways; using the PHP <code>mail()</code> function or directly via SMTP. Some hosting providers limit the <code>mail()</code> function to prevent its use in spamming, others may rename it or limit its functionality. If the <code>mail()</code> function got renamed, you are able to enter the correct name within the administration control panel. In either case you may need to make use of SMTP. This requires that you have access to such a facility, e.g. your hosting provider may provide one (perhaps requiring specific written authorisation), etc. Please see <a href="https://www.phpbb.com/">www.phpbb.com</a> for additional help on this matter.</p>
<p>If you do require SMTP services please do not ask (on our forums or elsewhere) for someone to provide you with one. Open relays are now things of the past thanks to the unthinking spammers out there. Therefore you are unlikely to find someone willing to offer you (free) services.</p>
@@ -243,7 +243,7 @@ I want to sue you because i think you host an illegal board!</h2>
<div class="content">
-<p>Please read the paragraph about permissions in our extensive <a href="http://www.phpbb.com/support/documentation/3.0/">online documentation</a>.</p>
+<p>Please read the paragraph about permissions in our extensive <a href="https://www.phpbb.com/support/documentation/3.0/">online documentation</a>.</p>
</div>
@@ -299,11 +299,11 @@ I want to sue you because i think you host an illegal board!</h2>
<div class="content">
-<p>Please read our <a href="http://www.phpbb.com/support/documentation/3.0/">extensive user documentation</a> first, it may just explain what you want to know.</p>
+<p>Please read our <a href="https://www.phpbb.com/support/documentation/3.0/">extensive user documentation</a> first, it may just explain what you want to know.</p>
<p>Feel free to search our community forum for the information you require. <strong>PLEASE DO NOT</strong> post your question without having first used search, chances are someone has already asked and answered your question. You can find our board here:</p>
-<p><a href="http://www.phpbb.com">www.phpbb.com</a></p>
+<p><a href="https://www.phpbb.com">www.phpbb.com</a></p>
</div>
@@ -321,7 +321,7 @@ I want to sue you because i think you host an illegal board!</h2>
<div class="content">
- <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
+ <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
</div>
diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html
index 58aeb904c7..937568cf10 100644
--- a/phpBB/docs/INSTALL.html
+++ b/phpBB/docs/INSTALL.html
@@ -39,7 +39,7 @@
<p>This document will walk you through the basics on installing, updating and converting the forum software.</p>
-<p>A basic overview of running phpBB3 can be found in the accompanying <a href="README.html">README</a> file. Please ensure you read that document in addition to this! For more detailed information on using, installing, updating and converting phpBB3 you should read <a href="http://www.phpbb.com/support/documentation/3.0/">the documentation</a> available online.</p>
+<p>A basic overview of running phpBB3 can be found in the accompanying <a href="README.html">README</a> file. Please ensure you read that document in addition to this! For more detailed information on using, installing, updating and converting phpBB3 you should read <a href="https://www.phpbb.com/support/documentation/3.0/">the documentation</a> available online.</p>
<h1>Install</h1>
@@ -220,7 +220,7 @@
<h4>Administrator details</h4>
- <p>Now you have to create your administration user. This user will have full administration access and he/she will be the first user on your forum. All fields on this page are required. You can also set the default language of your forum on this page. In a vanilla phpBB3 installation, we only include British English. You can download further languages from <a href="http://www.phpbb.com/">www.phpbb.com</a>, and add them before installing or later.</p>
+ <p>Now you have to create your administration user. This user will have full administration access and he/she will be the first user on your forum. All fields on this page are required. You can also set the default language of your forum on this page. In a vanilla phpBB3 installation, we only include British English. You can download further languages from <a href="https://www.phpbb.com/">www.phpbb.com</a>, and add them before installing or later.</p>
<h4>Configuration file</h4>
@@ -299,7 +299,7 @@
<p>To perform the update, either follow the instructions from the <strong>Administration Control Panel-&gt;System</strong> Tab - this should point out that you are running an outdated version and will guide you through the update - or follow the instructions listed below.</p>
<ul>
- <li>Go to the <a href="http://www.phpbb.com/downloads/">downloads page</a> and download the latest update package listed there, matching your current version.</li>
+ <li>Go to the <a href="https://www.phpbb.com/downloads/">downloads page</a> and download the latest update package listed there, matching your current version.</li>
<li>Upload the uncompressed archive contents to your phpBB installation - only the install folder is required. Upload the whole install folder, retaining the file structure.</li>
<li>After the install folder is present, phpBB3 will go offline automatically.</li>
<li>Point your browser to the install directory, for example <code>http://www.example.com/phpBB3/install/</code></li>
@@ -346,7 +346,7 @@
<p>As with install, the conversion is automated. Your previous 2.0.x database tables will not be changed and the original 2.0.x files will remain unaltered. The conversion is actually only filling your phpBB3 database tables and copying additional data over to your phpBB3 installation. This has the benefit that if something goes wrong, you are able to either re-run the conversion or continue a conversion, while your old board is still accessible. We really recommend that you disable your old installation while converting, else you may have inconsistent data after the conversion.</p>
- <p>Please note that this conversion process may take quite some time and depending on your hosting provider this may result in it failing (due to web server resource limits or other timeout issues). If this is the case, you should ask your provider if they are willing to allow the convert script to temporarily exceed their limits (be nice and they will probably be quite helpful). If your host is unwilling to increase the limits to run the convertor, please see this article for performing the conversion on your local machine: <a href="http://www.phpbb.com/kb/article/offline-conversions/">Knowledge Base - Offline Conversions</a></p>
+ <p>Please note that this conversion process may take quite some time and depending on your hosting provider this may result in it failing (due to web server resource limits or other timeout issues). If this is the case, you should ask your provider if they are willing to allow the convert script to temporarily exceed their limits (be nice and they will probably be quite helpful). If your host is unwilling to increase the limits to run the convertor, please see this article for performing the conversion on your local machine: <a href="https://www.phpbb.com/kb/article/offline-conversions/">Knowledge Base - Offline Conversions</a></p>
<p>Once completed, your board should be immediately available. If you encountered errors, you should report the problems to our bug tracker or seek help via our forums (see <a href="README.html">README</a> for details).</p>
@@ -430,7 +430,7 @@
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
- <p>Like any online site that allows user input, your board could be subject to unwanted posts; often referred to as <a href="http://en.wikipedia.org/wiki/Forum_spam">forum spam</a>. The vast majority of these attacks will be from automated computer programs known as <a href="http://en.wikipedia.org/wiki/Spambot">spambots</a>. The attacks, generally, are not personal as the spammers are just trying to find accessible targets. phpBB has a number of anti-spam measures built in, including a range of CAPTCHAs. However, administrators are strongly urged to read and follow the advice for <a href="http://www.phpbb.com/support/spam/">Preventing Spam in phpBB</a> as soon as possible after completing the installation of your board.</p>
+ <p>Like any online site that allows user input, your board could be subject to unwanted posts; often referred to as <a href="http://en.wikipedia.org/wiki/Forum_spam">forum spam</a>. The vast majority of these attacks will be from automated computer programs known as <a href="http://en.wikipedia.org/wiki/Spambot">spambots</a>. The attacks, generally, are not personal as the spammers are just trying to find accessible targets. phpBB has a number of anti-spam measures built in, including a range of CAPTCHAs. However, administrators are strongly urged to read and follow the advice for <a href="https://www.phpbb.com/support/spam/">Preventing Spam in phpBB</a> as soon as possible after completing the installation of your board.</p>
</div>
<div class="back2top"><a href="#wrap" class="top">Back to Top</a></div>
@@ -447,7 +447,7 @@
<div class="content">
- <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see the source code and <code>docs/</code> directory for more details. This package and its contents are Copyright &copy; <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
+ <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see the source code and <code>docs/</code> directory for more details. This package and its contents are Copyright &copy; <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
</div>
diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html
index 95a2f56825..899ca64fb5 100644
--- a/phpBB/docs/README.html
+++ b/phpBB/docs/README.html
@@ -126,21 +126,21 @@
<a name="i18n"></a><h3>2.i. Languages (Internationalisation - i18n)</h3>
- <p>A number of language packs with included style localisations are available. You can find them listed in the <a href="http://www.phpbb.com/languages/">Language Packs</a> pages of our downloads section or from the <a href="http://www.phpbb.com/customise/db/language_packs-25/">Language Packs</a> section of the <a href="http://www.phpbb.com/customise/db/">Customisation Database</a>.</p>
+ <p>A number of language packs with included style localisations are available. You can find them listed in the <a href="https://www.phpbb.com/languages/">Language Packs</a> pages of our downloads section or from the <a href="https://www.phpbb.com/customise/db/language_packs-25/">Language Packs</a> section of the <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p>
- <p>For more information about language packs, please see: <a href="http://www.phpbb.com/languages/">http://www.phpbb.com/languages/</a></p>
+ <p>For more information about language packs, please see: <a href="https://www.phpbb.com/languages/">https://www.phpbb.com/languages/</a></p>
<p>This is the <em>official</em> location for all supported language sets. If you download a package from a 3rd party site you do so with the understanding that we cannot offer support. Please do not ask for support if you download a language pack from a 3rd party site.</p>
- <p>Installation of these packages is straightforward: simply download the required language pack, uncompress (unzip) it and via FTP transfer the included <code>language</code> and <code>styles</code> folders to the root of your board installation. The language can then be installed via the Administration Control Panel of your board: <code>System tab -&gt; General Tasks -&gt; Language packs</code>. A more detailed description of the process is in the Knowledge Base article, <a href="http://www.phpbb.com/kb/article/how-to-install-a-language-pack/">How to Install a Language Pack</a>.</p>
+ <p>Installation of these packages is straightforward: simply download the required language pack, uncompress (unzip) it and via FTP transfer the included <code>language</code> and <code>styles</code> folders to the root of your board installation. The language can then be installed via the Administration Control Panel of your board: <code>System tab -&gt; General Tasks -&gt; Language packs</code>. A more detailed description of the process is in the Knowledge Base article, <a href="https://www.phpbb.com/kb/article/how-to-install-a-language-pack/">How to Install a Language Pack</a>.</p>
- <p>If your language is not available, please visit our <a href="http://www.phpbb.com/community/viewforum.php?f=66">[3.0.x] Translations</a> forum where you will find topics on translations in progress. Should you wish to volunteer to translate a language not currently available or assist in maintaining an existing language pack, you can <a href="http://www.phpbb.com/languages/apply.php">Apply to become a translator</a>.</p>
+ <p>If your language is not available, please visit our <a href="https://www.phpbb.com/community/viewforum.php?f=66">[3.0.x] Translations</a> forum where you will find topics on translations in progress. Should you wish to volunteer to translate a language not currently available or assist in maintaining an existing language pack, you can <a href="https://www.phpbb.com/languages/apply.php">Apply to become a translator</a>.</p>
<a name="styles"></a><h3>2.ii. Styles</h3>
- <p>Although the phpBB Group is rather proud of the included styles, we realise that they may not be to everyone's taste. Therefore, phpBB3 allows styles to be switched with relative ease. First, you need to locate and download a style you like. You can find them listed in the <a href="http://www.phpbb.com/customise/db/styles-2/">Styles</a> section of our <a href="http://www.phpbb.com/customise/db/">Customisation Database</a>.</p>
+ <p>Although the phpBB Group is rather proud of the included styles, we realise that they may not be to everyone's taste. Therefore, phpBB3 allows styles to be switched with relative ease. First, you need to locate and download a style you like. You can find them listed in the <a href="https://www.phpbb.com/customise/db/styles-2/">Styles</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p>
- <p>For more information about styles, please see: <a href="http://www.phpbb.com/styles/">http://www.phpbb.com/styles/</a></p>
+ <p>For more information about styles, please see: <a href="https://www.phpbb.com/styles/">https://www.phpbb.com/styles/</a></p>
<p><strong>Please note</strong> that 3rd party styles downloaded for versions of phpBB2 will <strong>not</strong> work in phpBB3. It is also important to ensure that the style is updated to match the current version of the phpBB software you are using.</p>
@@ -150,9 +150,9 @@
<a name="mods"></a><h3>2.iii. Modifications</h3>
- <p>Although not officially supported by the phpBB Group, phpBB has a thriving modification scene. These third party modifications to the standard phpBB software, known as <strong>MODs</strong>, extend its capabilities still further. You can browse through many of the MODs in the <a href="http://www.phpbb.com/customise/db/modifications-1/">Modifications</a> section of our <a href="http://www.phpbb.com/customise/db/">Customisation Database</a>.</p>
+ <p>Although not officially supported by the phpBB Group, phpBB has a thriving modification scene. These third party modifications to the standard phpBB software, known as <strong>MODs</strong>, extend its capabilities still further. You can browse through many of the MODs in the <a href="https://www.phpbb.com/customise/db/modifications-1/">Modifications</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p>
- <p>For more information about MODs, please see: <a href="http://www.phpbb.com/mods/">http://www.phpbb.com/mods/</a></p>
+ <p>For more information about MODs, please see: <a href="https://www.phpbb.com/mods/">https://www.phpbb.com/mods/</a></p>
<p><strong>Please remember</strong> that any bugs or other issues that occur after you have added any modification should <strong>NOT</strong> be reported to the bug tracker (see below). First remove the MOD and see if the problem is resolved. Any support for a MOD should only be sought in the &quot;Discussion/Support&quot; forum for that MOD.</p>
@@ -180,7 +180,7 @@
<p>Comprehensive documentation is now available on the phpBB website:</p>
- <p><a href="http://www.phpbb.com/support/documentation/3.0/">http://www.phpbb.com/support/documentation/3.0/</a></p>
+ <p><a href="https://www.phpbb.com/support/documentation/3.0/">https://www.phpbb.com/support/documentation/3.0/</a></p>
<p>This covers everything from installation to setting permissions and managing users.</p>
@@ -188,13 +188,13 @@
<p>The Knowledge Base consists of a number of detailed articles on some common issues phpBB users may encounter while using the product. The Knowledge Base can be found at:</p>
- <p><a href="http://www.phpbb.com/kb/">http://www.phpbb.com/kb/</a></p>
+ <p><a href="https://www.phpbb.com/kb/">https://www.phpbb.com/kb/</a></p>
<a name="website"></a><h3>3.iii. Community Forums</h3>
<p>The phpBB Group maintains a thriving community where a number of people have generously decided to donate their time to help support users. This site can be found at:</p>
- <p><a href="http://www.phpbb.com/community/">http://www.phpbb.com/community/</a></p>
+ <p><a href="https://www.phpbb.com/community/">https://www.phpbb.com/community/</a></p>
<p>If you do seek help via our forums please be sure to do a search before posting; if someone has experienced the issue before, then you may find that your question has already been answered. Please remember that phpBB is entirely staffed by volunteers, no one receives any compensation for the time they give, including moderators as well as developers; please be respectful and mindful when awaiting responses and receiving support.</p>
@@ -202,7 +202,7 @@
<p>Another place you may find help is our IRC channel. This operates on the Freenode IRC network, <a href="irc://irc.freenode.net">irc.freenode.net</a> and the channel is <em>#phpbb</em> and can be accessed by any decent IRC client such as mIRC, XChat, etc. Again, please do not abuse this service and be respectful of other users.</p>
- <p>There are other IRC channels available, please see <a href="http://www.phpbb.com/support/irc/">http://www.phpbb.com/support/irc/</a> for the complete list.</p>
+ <p>There are other IRC channels available, please see <a href="https://www.phpbb.com/support/irc/">https://www.phpbb.com/support/irc/</a> for the complete list.</p>
</div>
@@ -277,7 +277,7 @@
<p>If you find a potential security related vulnerability in phpBB please <strong>DO NOT</strong> post it to the bug tracker, public forums, etc.! Doing so may allow unscrupulous users to take advantage of it before we have time to put a fix in place. All security related bugs should be sent to our security tracker:</p>
- <p><a href="http://www.phpbb.com/security/">http://www.phpbb.com/security/</a></p>
+ <p><a href="https://www.phpbb.com/security/">https://www.phpbb.com/security/</a></p>
</div>
@@ -345,7 +345,7 @@
<div class="content">
- <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright &copy; <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
+ <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright &copy; <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
</div>
diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html
index 249ceebfbc..f45ea5e5c8 100644
--- a/phpBB/docs/auth_api.html
+++ b/phpBB/docs/auth_api.html
@@ -268,7 +268,7 @@ $auth_admin = new auth_admin();
<div class="content">
- <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
+ <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
</div>
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index e73c563d5b..7c588a4905 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -1315,7 +1315,7 @@ parent = prosilver
<span class="comment">&lt;!-- INCLUDEPHP somefile&#46;php --&gt;</span>
</pre></div>
-<p>it will be included and executed inline.<br /><br />A note, it is very much encouraged that template designers do not include PHP. The ability to include raw PHP was introduced primarily to allow end users to include banner code, etc. without modifying multiple files (as with 2.0.x). It was not intended for general use ... hence <!-- w --><a href="http://www.phpbb.com">www.phpbb.com</a><!-- w --> will <strong>not</strong> make available template sets which include PHP. And by default templates will have PHP disabled (the admin will need to specifically activate PHP for a template).</p>
+<p>it will be included and executed inline.<br /><br />A note, it is very much encouraged that template designers do not include PHP. The ability to include raw PHP was introduced primarily to allow end users to include banner code, etc. without modifying multiple files (as with 2.0.x). It was not intended for general use ... hence <!-- w --><a href="https://www.phpbb.com">www.phpbb.com</a><!-- w --> will <strong>not</strong> make available template sets which include PHP. And by default templates will have PHP disabled (the admin will need to specifically activate PHP for a template).</p>
<h4>Conditionals/Control structures</h4>
<p>The most significant addition to 3.x are conditions or control structures, &quot;if something then do this else do that&quot;. The system deployed is very similar to Smarty. This may confuse some people at first but it offers great potential and great flexibility with a little imagination. In their most simple form these constructs take the form:</p>
@@ -2499,7 +2499,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
<div class="content">
- <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
+ <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
</div>
diff --git a/phpBB/docs/hook_system.html b/phpBB/docs/hook_system.html
index 6dd84bfc23..3f209b8a34 100644
--- a/phpBB/docs/hook_system.html
+++ b/phpBB/docs/hook_system.html
@@ -861,7 +861,7 @@ function phpbb_hook_register(&amp;$hook)
<div class="content">
- <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
+ <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="https://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p>
</div>
diff --git a/phpBB/docs/sphinx.sample.conf b/phpBB/docs/sphinx.sample.conf
index d1b98d6cbc..620ec25761 100644
--- a/phpBB/docs/sphinx.sample.conf
+++ b/phpBB/docs/sphinx.sample.conf
@@ -15,6 +15,7 @@ source source_phpbb_{SPHINX_ID}_main
p.forum_id, \
p.topic_id, \
p.poster_id, \
+ p.post_visibility, \
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, \
p.post_time, \
p.post_subject, \
@@ -32,6 +33,7 @@ source source_phpbb_{SPHINX_ID}_main
sql_attr_uint = forum_id
sql_attr_uint = topic_id
sql_attr_uint = poster_id
+ sql_attr_uint = post_visibility
sql_attr_bool = topic_first_post
sql_attr_bool = deleted
sql_attr_timestamp = post_time
@@ -48,6 +50,7 @@ source source_phpbb_{SPHINX_ID}_delta : source_phpbb_{SPHINX_ID}_main
p.forum_id, \
p.topic_id, \
p.poster_id, \
+ p.post_visibility, \
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, \
p.post_time, \
p.post_subject, \
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index cf7128b25b..5a091db7c7 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -41,7 +41,7 @@ if (isset($_GET['avatar']))
exit;
}
- require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
+ require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
@@ -50,7 +50,7 @@ if (isset($_GET['avatar']))
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Setup class loader first
- $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
+ $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 24b913260b..12e2a1bf72 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -528,10 +528,10 @@ class acp_board
$old_auth_config = array();
foreach ($auth_providers as $provider)
{
- if ($fields = $provider->acp($this->new_config))
+ if ($fields = $provider->acp())
{
// Check if we need to create config fields for this plugin and save config when submit was pressed
- foreach ($fields['config'] as $field)
+ foreach ($fields as $field)
{
if (!isset($config[$field]))
{
@@ -655,15 +655,14 @@ class acp_board
foreach ($auth_providers as $provider)
{
- $fields = $provider->acp($this->new_config);
-
- if ($fields['tpl'])
+ $auth_tpl = $provider->get_acp_template($this->new_config);
+ if ($auth_tpl)
{
+ $template->assign_vars($auth_tpl['TEMPLATE_VARS']);
$template->assign_block_vars('auth_tpl', array(
- 'TPL' => $fields['tpl'],
+ 'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'],
));
}
- unset($fields);
}
}
}
@@ -678,8 +677,12 @@ class acp_board
$auth_plugins = array();
$auth_providers = $phpbb_container->get('auth.provider_collection');
- foreach($auth_providers as $key => $value)
+ foreach ($auth_providers as $key => $value)
{
+ if (!($value instanceof phpbb_auth_provider_interface))
+ {
+ continue;
+ }
$auth_plugins[] = str_replace('auth.provider.', '', $key);
}
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index ebcbd28a87..5d191b3d0f 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -28,10 +28,6 @@ class acp_database
global $cache, $db, $user, $auth, $template, $table_prefix;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
- if (!class_exists('phpbb_db_tools'))
- {
- require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx);
- }
$this->db_tools = new phpbb_db_tools($db);
$user->add_lang('acp/database');
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index 7e8d5d8388..970b033995 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -283,7 +283,7 @@ class acp_forums
@set_time_limit(0);
- $sql = 'SELECT forum_name, forum_topics_real
+ $sql = 'SELECT forum_name, (forum_topics_approved + forum_topics_unapproved + forum_topics_softdeleted) AS total_topics
FROM ' . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
$result = $db->sql_query($sql);
@@ -295,7 +295,7 @@ class acp_forums
trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
}
- if ($row['forum_topics_real'])
+ if ($row['total_topics'])
{
$sql = 'SELECT MIN(topic_id) as min_topic_id, MAX(topic_id) as max_topic_id
FROM ' . TOPICS_TABLE . '
@@ -314,7 +314,6 @@ class acp_forums
$end = $start + $batch_size;
// Sync all topics in batch mode...
- sync('topic_approved', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, false);
sync('topic', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, true);
if ($end < $row2['max_topic_id'])
@@ -330,15 +329,15 @@ class acp_forums
$start += $batch_size;
- $url = $this->u_action . "&amp;parent_id={$this->parent_id}&amp;f=$forum_id&amp;action=sync&amp;start=$start&amp;topics_done=$topics_done&amp;total={$row['forum_topics_real']}";
+ $url = $this->u_action . "&amp;parent_id={$this->parent_id}&amp;f=$forum_id&amp;action=sync&amp;start=$start&amp;topics_done=$topics_done&amp;total={$row['total_topics']}";
meta_refresh(0, $url);
$template->assign_vars(array(
- 'U_PROGRESS_BAR' => $this->u_action . "&amp;action=progress_bar&amp;start=$topics_done&amp;total={$row['forum_topics_real']}",
- 'UA_PROGRESS_BAR' => addslashes($this->u_action . "&amp;action=progress_bar&amp;start=$topics_done&amp;total={$row['forum_topics_real']}"),
+ 'U_PROGRESS_BAR' => $this->u_action . "&amp;action=progress_bar&amp;start=$topics_done&amp;total={$row['total_topics']}",
+ 'UA_PROGRESS_BAR' => addslashes($this->u_action . "&amp;action=progress_bar&amp;start=$topics_done&amp;total={$row['total_topics']}"),
'S_CONTINUE_SYNC' => true,
- 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $topics_done, $row['forum_topics_real']))
+ 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $topics_done, $row['total_topics']))
);
return;
@@ -352,7 +351,7 @@ class acp_forums
'U_PROGRESS_BAR' => $this->u_action . '&amp;action=progress_bar',
'UA_PROGRESS_BAR' => addslashes($this->u_action . '&amp;action=progress_bar'),
'S_CONTINUE_SYNC' => true,
- 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], 0, $row['forum_topics_real']))
+ 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], 0, $row['total_topics']))
);
return;
@@ -857,8 +856,8 @@ class acp_forums
'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
'FORUM_NAME' => $row['forum_name'],
'FORUM_DESCRIPTION' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']),
- 'FORUM_TOPICS' => $row['forum_topics'],
- 'FORUM_POSTS' => $row['forum_posts'],
+ 'FORUM_TOPICS' => $row['forum_topics_approved'],
+ 'FORUM_POSTS' => $row['forum_posts_approved'],
'S_FORUM_LINK' => ($forum_type == FORUM_LINK) ? true : false,
'S_FORUM_POST' => ($forum_type == FORUM_POST) ? true : false,
@@ -1144,7 +1143,8 @@ class acp_forums
return array($user->lang['NO_FORUM_ACTION']);
}
- $forum_data_sql['forum_posts'] = $forum_data_sql['forum_topics'] = $forum_data_sql['forum_topics_real'] = $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0;
+ $forum_data_sql['forum_posts_approved'] = $forum_data_sql['forum_posts_unapproved'] = $forum_data_sql['forum_posts_softdeleted'] = $forum_data_sql['forum_topics_approved'] = $forum_data_sql['forum_topics_unapproved'] = $forum_data_sql['forum_topics_softdeleted'] = 0;
+ $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0;
$forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = '';
}
else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_LINK)
@@ -1264,9 +1264,12 @@ class acp_forums
else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_POST)
{
// Changing a category to a forum? Reset the data (you can't post directly in a cat, you must use a forum)
- $forum_data_sql['forum_posts'] = 0;
- $forum_data_sql['forum_topics'] = 0;
- $forum_data_sql['forum_topics_real'] = 0;
+ $forum_data_sql['forum_posts_approved'] = 0;
+ $forum_data_sql['forum_posts_unapproved'] = 0;
+ $forum_data_sql['forum_posts_softdeleted'] = 0;
+ $forum_data_sql['forum_topics_approved'] = 0;
+ $forum_data_sql['forum_topics_unapproved'] = 0;
+ $forum_data_sql['forum_topics_softdeleted'] = 0;
$forum_data_sql['forum_last_post_id'] = 0;
$forum_data_sql['forum_last_post_subject'] = '';
$forum_data_sql['forum_last_post_time'] = 0;
@@ -1793,7 +1796,7 @@ class acp_forums
FROM ' . POSTS_TABLE . '
WHERE forum_id = ' . $forum_id . '
AND post_postcount = 1
- AND post_approved = 1';
+ AND post_visibility = ' . ITEM_APPROVED;
$result = $db->sql_query($sql);
$post_counts = array();
@@ -1931,7 +1934,7 @@ class acp_forums
// Make sure the overall post/topic count is correct...
$sql = 'SELECT COUNT(post_id) AS stat
FROM ' . POSTS_TABLE . '
- WHERE post_approved = 1';
+ WHERE post_visibility = ' . ITEM_APPROVED;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -1940,7 +1943,7 @@ class acp_forums
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
- WHERE topic_approved = 1';
+ WHERE topic_visibility = ' . ITEM_APPROVED;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index c79699d465..e6a36c97a8 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -410,7 +410,7 @@ class acp_groups
if ($validation_error = validate_data($submit_ary, $validation_checks))
{
// Replace "error" string with its real, localised form
- $error = array_merge($error, array_map(array(&$user, 'lang'), $validation_error));
+ $error = array_merge($error, $validation_error);
}
if (!sizeof($error))
@@ -507,6 +507,7 @@ class acp_groups
if (sizeof($error))
{
+ $error = array_map(array(&$user, 'lang'), $error);
$group_rank = $submit_ary['rank'];
$group_desc_data = array(
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index c44bc1b8a6..eecd8c72dc 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -63,9 +63,7 @@ class acp_main
if ($action === 'admlogout')
{
$user->unset_admin();
- $redirect_url = append_sid("{$phpbb_root_path}index.$phpEx");
- meta_refresh(3, $redirect_url);
- trigger_error($user->lang['ADM_LOGGED_OUT'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect_url . '">', '</a>'));
+ redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
if (!confirm_box(true))
@@ -144,14 +142,14 @@ class acp_main
$sql = 'SELECT COUNT(post_id) AS stat
FROM ' . POSTS_TABLE . '
- WHERE post_approved = 1';
+ WHERE post_visibility = ' . ITEM_APPROVED;
$result = $db->sql_query($sql);
set_config('num_posts', (int) $db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result);
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
- WHERE topic_approved = 1';
+ WHERE topic_visibility = ' . ITEM_APPROVED;
$result = $db->sql_query($sql);
set_config('num_topics', (int) $db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result);
@@ -232,7 +230,7 @@ class acp_main
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
FROM ' . POSTS_TABLE . '
WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . '
- AND post_postcount = 1 AND post_approved = 1
+ AND post_postcount = 1 AND post_visibility = ' . ITEM_APPROVED . '
GROUP BY poster_id';
$result = $db->sql_query($sql);
@@ -430,7 +428,7 @@ class acp_main
{
$template->assign_vars(array(
'S_PHP_VERSION_OLD' => true,
- 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="http://www.phpbb.com/community/viewtopic.php?f=14&amp;t=2152375">', '</a>'),
+ 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="https://www.phpbb.com/community/viewtopic.php?f=14&amp;t=2152375">', '</a>'),
));
}
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index ab416fb406..7a1d30196d 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -379,6 +379,7 @@ class acp_modules
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang('ERROR'),
'MESSAGE_TEXT' => implode('<br />', $errors),
+ 'SUCCESS' => false,
));
}
@@ -575,13 +576,20 @@ class acp_modules
// format. phpbb_acp_info_acp_foo needs to be turned into
// acp_foo_info and the respective file has to be included
// manually because it does not support auto loading
- if (!class_exists($info_class))
+ $old_info_class_file = str_replace("phpbb_{$module_class}_info_", '', $cur_module);
+ $old_info_class = $old_info_class_file . '_info';
+
+ if (class_exists($old_info_class))
+ {
+ $info_class = $old_info_class;
+ }
+ else if (!class_exists($info_class))
{
- $info_class_file = str_replace("phpbb_{$module_class}_info_", '', $cur_module);
- $info_class = $info_class_file . '_info';
- if (!class_exists($info_class) && file_exists($directory . $info_class_file . '.' . $phpEx))
+ $info_class = $old_info_class;
+ // need to check class exists again because previous checks triggered autoloading
+ if (!class_exists($info_class) && file_exists($directory . $old_info_class_file . '.' . $phpEx))
{
- include($directory . $info_class_file . '.' . $phpEx);
+ include($directory . $old_info_class_file . '.' . $phpEx);
}
}
diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php
index e830479389..17e48d6576 100644
--- a/phpBB/includes/acp/acp_permission_roles.php
+++ b/phpBB/includes/acp/acp_permission_roles.php
@@ -25,7 +25,7 @@ class acp_permission_roles
function main($id, $mode)
{
- global $db, $user, $auth, $template, $cache;
+ global $db, $user, $auth, $template, $cache, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
@@ -306,6 +306,8 @@ class acp_permission_roles
trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
}
+ $phpbb_permissions = $phpbb_container->get('acl.permissions');
+
$template->assign_vars(array(
'S_EDIT' => true,
@@ -314,9 +316,8 @@ class acp_permission_roles
'ROLE_NAME' => $role_row['role_name'],
'ROLE_DESCRIPTION' => $role_row['role_description'],
- 'L_ACL_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)],
- )
- );
+ 'L_ACL_TYPE' => $phpbb_permissions->get_type_lang($permission_type),
+ ));
// We need to fill the auth options array with ACL_NO options ;)
$sql = 'SELECT auth_option_id, auth_option
@@ -456,7 +457,9 @@ class acp_permission_roles
*/
function display_auth_options($auth_options)
{
- global $template, $user;
+ global $template, $user, $phpbb_container;
+
+ $phpbb_permissions = $phpbb_container->get('acl.permissions');
$content_array = $categories = array();
$key_sort_array = array(0);
@@ -473,7 +476,7 @@ class acp_permission_roles
foreach ($content_array as $cat => $cat_array)
{
$template->assign_block_vars('auth', array(
- 'CAT_NAME' => $user->lang['permission_cat'][$cat],
+ 'CAT_NAME' => $phpbb_permissions->get_category_lang($cat),
'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false,
'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
@@ -488,8 +491,8 @@ class acp_permission_roles
'S_NO' => ($allowed == ACL_NO) ? true : false,
'FIELD_NAME' => $permission,
- 'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
- );
+ 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission),
+ ));
}
}
}
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index a64765f4f5..ed7159996a 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -22,15 +22,18 @@ class acp_permissions
{
var $u_action;
var $permission_dropdown;
+ protected $permissions;
function main($id, $mode)
{
- global $db, $user, $auth, $template, $cache;
+ global $db, $user, $auth, $template, $cache, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
+ $this->permissions = $phpbb_container->get('acl.permissions');
+
$auth_admin = new auth_admin();
$user->add_lang('acp/permissions');
@@ -49,7 +52,7 @@ class acp_permissions
if ($user_id && isset($auth_admin->acl_options['id'][$permission]) && $auth->acl_get('a_viewauth'))
{
- $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $user->lang['acl_' . $permission]['lang']);
+ $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $this->permissions->get_permission_lang($permission));
$this->permission_trace($user_id, $forum_id, $permission);
return;
}
@@ -512,7 +515,7 @@ class acp_permissions
$template->assign_vars(array(
'S_PERMISSION_DROPDOWN' => (sizeof($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false,
- 'L_PERMISSION_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)],
+ 'L_PERMISSION_TYPE' => $this->permissions->get_type_lang($permission_type),
'U_ACTION' => $this->u_action,
'S_HIDDEN_FIELDS' => $s_hidden_fields)
@@ -587,7 +590,7 @@ class acp_permissions
*/
function build_permission_dropdown($options, $default_option, $permission_scope)
{
- global $user, $auth;
+ global $auth;
$s_dropdown_options = '';
foreach ($options as $setting)
@@ -598,7 +601,7 @@ class acp_permissions
}
$selected = ($setting == $default_option) ? ' selected="selected"' : '';
- $l_setting = (isset($user->lang['permission_type'][$permission_scope][$setting])) ? $user->lang['permission_type'][$permission_scope][$setting] : $user->lang['permission_type'][$setting];
+ $l_setting = $this->permissions->get_type_lang($setting, $permission_scope);
$s_dropdown_options .= '<option value="' . $setting . '"' . $selected . '>' . $l_setting . '</option>';
}
@@ -979,7 +982,7 @@ class acp_permissions
$back = request_var('back', 0);
$template->assign_vars(array(
- 'PERMISSION' => $user->lang['acl_' . $permission]['lang'],
+ 'PERMISSION' => $this->permissions->get_permission_lang($permission),
'PERMISSION_USERNAME' => $userdata['username'],
'FORUM_NAME' => $forum_name,
diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php
index 6618e2c3f9..11a2511aee 100644
--- a/phpBB/includes/acp/acp_search.php
+++ b/phpBB/includes/acp/acp_search.php
@@ -560,7 +560,7 @@ class acp_search
return $finder
->extension_suffix('_backend')
->extension_directory('/search')
- ->core_path('includes/search/')
+ ->core_path('phpbb/search/')
->get_classes();
}
diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php
index 4421fbef18..39140b8da4 100644
--- a/phpBB/includes/acp/acp_send_statistics.php
+++ b/phpBB/includes/acp/acp_send_statistics.php
@@ -28,7 +28,7 @@ class acp_send_statistics
include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx);
- $collect_url = "http://www.phpbb.com/stats/receive_stats.php";
+ $collect_url = "https://www.phpbb.com/stats/receive_stats.php";
$this->tpl_name = 'acp_send_statistics';
$this->page_title = 'ACP_SEND_STATISTICS';
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index c8542ddbe7..cbfd578d87 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -624,29 +624,31 @@ class acp_users
$topic_id_ary = $move_topic_ary = $move_post_ary = $new_topic_id_ary = array();
$forum_id_ary = array($new_forum_id);
- $sql = 'SELECT topic_id, COUNT(post_id) AS total_posts
+ $sql = 'SELECT topic_id, post_visibility, COUNT(post_id) AS total_posts
FROM ' . POSTS_TABLE . "
WHERE poster_id = $user_id
AND forum_id <> $new_forum_id
- GROUP BY topic_id";
+ GROUP BY topic_id, post_visibility";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
- $topic_id_ary[$row['topic_id']] = $row['total_posts'];
+ $topic_id_ary[$row['topic_id']][$row['post_visibility']] = $row['total_posts'];
}
$db->sql_freeresult($result);
if (sizeof($topic_id_ary))
{
- $sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_replies_real, topic_attachment
+ $sql = 'SELECT topic_id, forum_id, topic_title, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_attachment
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary));
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
- if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']])
+ if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts_approved']
+ && $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved']
+ && $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted'])
{
$move_topic_ary[] = $row['topic_id'];
}
@@ -679,7 +681,7 @@ class acp_users
'topic_time' => time(),
'forum_id' => $new_forum_id,
'icon_id' => 0,
- 'topic_approved' => 1,
+ 'topic_visibility' => ITEM_APPROVED,
'topic_title' => $post_ary['title'],
'topic_first_poster_name' => $user_row['username'],
'topic_type' => POST_NORMAL,
@@ -1036,7 +1038,7 @@ class acp_users
$sql = 'SELECT COUNT(post_id) as posts_in_queue
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $user_id . '
- AND post_approved = 0';
+ AND post_visibility = ' . ITEM_UNAPPROVED;
$result = $db->sql_query($sql);
$user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
$db->sql_freeresult($result);
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 6b1da46a12..4ade9cab13 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -261,7 +261,8 @@ class auth_admin extends phpbb_auth
*/
function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)
{
- global $template, $user, $db, $phpbb_root_path, $phpEx;
+ global $template, $user, $db, $phpbb_root_path, $phpEx, $phpbb_container;
+ $phpbb_permissions = $phpbb_container->get('acl.permissions');
// Define names for template loops, might be able to be set
$tpl_pmask = 'p_mask';
@@ -269,7 +270,7 @@ class auth_admin extends phpbb_auth
$tpl_category = 'category';
$tpl_mask = 'mask';
- $l_acl_type = (isset($user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)])) ? $user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type);
+ $l_acl_type = $phpbb_permissions->get_type_lang($permission_type, (($local) ? 'local' : 'global'));
// Allow trace for viewing permissions and in user mode
$show_trace = ($mode == 'view' && $user_mode == 'user') ? true : false;
@@ -1100,7 +1101,9 @@ class auth_admin extends phpbb_auth
*/
function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view)
{
- global $template, $user, $phpbb_admin_path, $phpEx;
+ global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container;
+
+ $phpbb_permissions = $phpbb_container->get('acl.permissions');
@reset($category_array);
while (list($cat, $cat_array) = each($category_array))
@@ -1110,8 +1113,8 @@ class auth_admin extends phpbb_auth
'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false,
- 'CAT_NAME' => $user->lang['permission_cat'][$cat])
- );
+ 'CAT_NAME' => $phpbb_permissions->get_category_lang($cat),
+ ));
/* Sort permissions by name (more naturaly and user friendly than sorting by a primary key)
* Commented out due to it's memory consumption and time needed
@@ -1145,8 +1148,8 @@ class auth_admin extends phpbb_auth
'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&amp;mode=trace&amp;u=$ug_id&amp;f=$forum_id&amp;auth=$permission") : '',
'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '',
- 'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
- );
+ 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission),
+ ));
}
else
{
@@ -1163,8 +1166,8 @@ class auth_admin extends phpbb_auth
'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&amp;mode=trace&amp;u=$ug_id&amp;f=$forum_id&amp;auth=$permission") : '',
'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '',
- 'PERMISSION' => $user->lang['acl_' . $permission]['lang'])
- );
+ 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission),
+ ));
}
}
}
@@ -1176,7 +1179,9 @@ class auth_admin extends phpbb_auth
*/
function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array)
{
- global $user;
+ global $user, $phpbb_container;
+
+ $phpbb_permissions = $phpbb_container->get('acl.permissions');
foreach ($key_sort_array as $forum_id)
{
@@ -1191,20 +1196,12 @@ class auth_admin extends phpbb_auth
@reset($permissions);
while (list($permission, $auth_setting) = each($permissions))
{
- if (!isset($user->lang['acl_' . $permission]))
- {
- $user->lang['acl_' . $permission] = array(
- 'cat' => 'misc',
- 'lang' => '{ acl_' . $permission . ' }'
- );
- }
-
- $cat = $user->lang['acl_' . $permission]['cat'];
+ $cat = $phpbb_permissions->get_permission_category($permission);
// Build our categories array
if (!isset($categories[$cat]))
{
- $categories[$cat] = $user->lang['permission_cat'][$cat];
+ $categories[$cat] = $phpbb_permissions->get_category_lang($cat);
}
// Build our content array
diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php
index 1ed8e119b5..fac45087e3 100644
--- a/phpBB/includes/captcha/captcha_factory.php
+++ b/phpBB/includes/captcha/captcha_factory.php
@@ -50,7 +50,8 @@ class phpbb_captcha_factory
{
include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx);
}
- call_user_func(array($name, 'garbage_collect'), 0);
+ $captcha = self::get_instance($name);
+ $captcha->garbage_collect(0);
}
/**
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
index ec7636f511..6843f25d72 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
@@ -110,12 +110,8 @@ class phpbb_captcha_qa
*/
static public function is_installed()
{
- global $db, $phpbb_root_path, $phpEx;
+ global $db;
- if (!class_exists('phpbb_db_tools', false))
- {
- include("$phpbb_root_path/includes/db/db_tools.$phpEx");
- }
$db_tool = new phpbb_db_tools($db);
return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE);
@@ -297,12 +293,8 @@ class phpbb_captcha_qa
*/
function install()
{
- global $db, $phpbb_root_path, $phpEx;
+ global $db;
- if (!class_exists('phpbb_db_tools'))
- {
- include("$phpbb_root_path/includes/db/db_tools.$phpEx");
- }
$db_tool = new phpbb_db_tools($db);
$tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE);
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 96011f4ec5..c1f4c6ac0e 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -87,6 +87,10 @@ define('ITEM_UNLOCKED', 0);
define('ITEM_LOCKED', 1);
define('ITEM_MOVED', 2);
+define('ITEM_UNAPPROVED', 0); // => has not yet been approved
+define('ITEM_APPROVED', 1); // => has been approved, and has not been soft deleted
+define('ITEM_DELETED', 2); // => has been soft deleted
+
// Forum Flags
define('FORUM_FLAG_LINK_TRACK', 1);
define('FORUM_FLAG_PRUNE_POLL', 2);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 6a1b3fd4f8..49f2e469bc 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1974,7 +1974,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
*/
function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false)
{
- global $db, $tracking_topics, $user, $config, $auth, $request;
+ global $db, $tracking_topics, $user, $config, $auth, $request, $phpbb_container;
// Determine the users last forum mark time if not given.
if ($mark_time_forum === false)
@@ -1999,7 +1999,7 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
// Handle update of unapproved topics info.
// Only update for moderators having m_approve permission for the forum.
- $sql_update_unapproved = ($auth->acl_get('m_approve', $forum_id)) ? '': 'AND t.topic_approved = 1';
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
// Check the forum for any left unread topics.
// If there are none, we mark the forum as read.
@@ -2019,8 +2019,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
AND tt.user_id = ' . $user->data['user_id'] . ')
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_last_post_time > ' . $mark_time_forum . '
- AND t.topic_moved_id = 0 ' .
- $sql_update_unapproved . '
+ AND t.topic_moved_id = 0
+ AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . '
AND (tt.topic_id IS NULL
OR tt.mark_time < t.topic_last_post_time)';
$result = $db->sql_query_limit($sql, 1);
@@ -2044,8 +2044,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_last_post_time > ' . $mark_time_forum . '
- AND t.topic_moved_id = 0 ' .
- $sql_update_unapproved;
+ AND t.topic_moved_id = 0
+ AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
$result = $db->sql_query($sql);
$check_forum = $tracking_topics['tf'][$forum_id];
@@ -3301,8 +3301,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
return;
}
- $redirect = meta_refresh(3, $redirect);
- trigger_error($message . '<br /><br />' . sprintf($l_redirect, '<a href="' . $redirect . '">', '</a>'));
+ redirect($redirect);
}
// Something failed, determine what...
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index ff0e2a1ac1..60c44e90e1 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -82,6 +82,8 @@ function adm_page_header($page_title)
'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/",
'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/",
+ 'T_ASSETS_VERSION' => $config['assets_version'],
+
'ICON_MOVE_UP' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
'ICON_MOVE_UP_DISABLED' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
'ICON_MOVE_DOWN' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 21662eb493..fc29492ac1 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -644,7 +644,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
'posts' => ($call_delete_posts) ? delete_posts($where_type, $where_ids, false, true, $post_count_sync, false) : 0,
);
- $sql = 'SELECT topic_id, forum_id, topic_approved, topic_moved_id
+ $sql = 'SELECT topic_id, forum_id, topic_visibility, topic_moved_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $where_clause;
$result = $db->sql_query($sql);
@@ -654,7 +654,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
$forum_ids[] = $row['forum_id'];
$topic_ids[] = $row['topic_id'];
- if ($row['topic_approved'] && !$row['topic_moved_id'])
+ if ($row['topic_visibility'] == ITEM_APPROVED && !$row['topic_moved_id'])
{
$approved_topics++;
}
@@ -775,7 +775,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
$approved_posts = 0;
$post_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array();
- $sql = 'SELECT post_id, poster_id, post_approved, post_postcount, topic_id, forum_id
+ $sql = 'SELECT post_id, poster_id, post_visibility, post_postcount, topic_id, forum_id
FROM ' . POSTS_TABLE . '
WHERE ' . $where_clause;
$result = $db->sql_query($sql);
@@ -787,12 +787,12 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
$topic_ids[] = (int) $row['topic_id'];
$forum_ids[] = (int) $row['forum_id'];
- if ($row['post_postcount'] && $post_count_sync && $row['post_approved'])
+ if ($row['post_postcount'] && $post_count_sync && $row['post_visibility'] == ITEM_APPROVED)
{
$post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1;
}
- if ($row['post_approved'])
+ if ($row['post_visibility'] == ITEM_APPROVED)
{
$approved_posts++;
}
@@ -889,7 +889,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
sync('forum', 'forum_id', $forum_ids, true, true);
}
- if ($approved_posts)
+ if ($approved_posts && $post_count_sync)
{
set_config_count('num_posts', $approved_posts * (-1), true);
}
@@ -1292,7 +1292,7 @@ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false)
* - forum Resync complete forum
* - topic Resync topics
* - topic_moved Removes topic shadows that would be in the same forum as the topic they link to
-* - topic_approved Resyncs the topic_approved flag according to the status of the first post
+* - topic_visibility Resyncs the topic_visibility flag according to the status of the first post
* - post_reported Resyncs the post_reported flag, relying on actual reports
* - topic_reported Resyncs the topic_reported flag, relying on post_reported flags
* - post_attachement Same as post_reported, but with attachment flags
@@ -1312,7 +1312,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$where_ids = ($where_ids) ? array((int) $where_ids) : array();
}
- if ($mode == 'forum' || $mode == 'topic' || $mode == 'topic_approved' || $mode == 'topic_reported' || $mode == 'post_reported')
+ if ($mode == 'forum' || $mode == 'topic' || $mode == 'topic_visibility' || $mode == 'topic_reported' || $mode == 'post_reported')
{
if (!$where_type)
{
@@ -1398,43 +1398,55 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$db->sql_transaction('commit');
break;
- case 'topic_approved':
+ case 'topic_visibility':
$db->sql_transaction('begin');
- switch ($db->sql_layer)
+
+ $sql = 'SELECT t.topic_id, p.post_visibility
+ FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
+ $where_sql_and p.topic_id = t.topic_id
+ AND p.post_visibility = " . ITEM_APPROVED;
+ $result = $db->sql_query($sql);
+
+ $topics_approved = array();
+ while ($row = $db->sql_fetchrow($result))
{
- case 'mysql4':
- case 'mysqli':
- $sql = 'UPDATE ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
- SET t.topic_approved = p.post_approved
- $where_sql_and t.topic_first_post_id = p.post_id";
- $db->sql_query($sql);
- break;
+ $topics_approved[] = (int) $row['topic_id'];
+ }
+ $db->sql_freeresult($result);
- default:
- $sql = 'SELECT t.topic_id, p.post_approved
- FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
- $where_sql_and p.post_id = t.topic_first_post_id
- AND p.post_approved <> t.topic_approved";
- $result = $db->sql_query($sql);
+ $sql = 'SELECT t.topic_id, p.post_visibility
+ FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
+ $where_sql_and " . $db->sql_in_set('t.topic_id', $topics_approved, true, true) . '
+ AND p.topic_id = t.topic_id
+ AND p.post_visibility = ' . ITEM_DELETED;
+ $result = $db->sql_query($sql);
- $topic_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $topic_ids[] = $row['topic_id'];
- }
- $db->sql_freeresult($result);
+ $topics_softdeleted = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $topics_softdeleted[] = (int) $row['topic_id'];
+ }
+ $db->sql_freeresult($result);
- if (!sizeof($topic_ids))
- {
- return;
- }
+ $topics_softdeleted = array_diff($topics_softdeleted, $topics_approved);
+ $topics_not_unapproved = array_merge($topics_softdeleted, $topics_approved);
+
+ $update_ary = array(
+ ITEM_UNAPPROVED => (!empty($topics_not_unapproved)) ? $where_sql_and . ' ' . $db->sql_in_set('topic_id', $topics_not_unapproved, true) : '',
+ ITEM_APPROVED => (!empty($topics_approved)) ? ' WHERE ' . $db->sql_in_set('topic_id', $topics_approved) : '',
+ ITEM_DELETED => (!empty($topics_softdeleted)) ? ' WHERE ' . $db->sql_in_set('topic_id', $topics_softdeleted) : '',
+ );
+ foreach ($topic_visiblities as $visibility => $sql_where)
+ {
+ if ($sql_where)
+ {
$sql = 'UPDATE ' . TOPICS_TABLE . '
- SET topic_approved = 1 - topic_approved
- WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
+ SET topic_visibility = ' . $visibility . '
+ ' . $sql_where;
$db->sql_query($sql);
- break;
+ }
}
$db->sql_transaction('commit');
@@ -1675,9 +1687,12 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$forum_data[$forum_id] = $row;
if ($sync_extra)
{
- $forum_data[$forum_id]['posts'] = 0;
- $forum_data[$forum_id]['topics'] = 0;
- $forum_data[$forum_id]['topics_real'] = 0;
+ $forum_data[$forum_id]['posts_approved'] = 0;
+ $forum_data[$forum_id]['posts_unapproved'] = 0;
+ $forum_data[$forum_id]['posts_softdeleted'] = 0;
+ $forum_data[$forum_id]['topics_approved'] = 0;
+ $forum_data[$forum_id]['topics_unapproved'] = 0;
+ $forum_data[$forum_id]['topics_softdeleted'] = 0;
}
$forum_data[$forum_id]['last_post_id'] = 0;
$forum_data[$forum_id]['last_post_subject'] = '';
@@ -1698,20 +1713,27 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
// 2: Get topic counts for each forum (optional)
if ($sync_extra)
{
- $sql = 'SELECT forum_id, topic_approved, COUNT(topic_id) AS forum_topics
+ $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS total_topics
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . '
- GROUP BY forum_id, topic_approved';
+ GROUP BY forum_id, topic_visibility';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_id = (int) $row['forum_id'];
- $forum_data[$forum_id]['topics_real'] += $row['forum_topics'];
- if ($row['topic_approved'])
+ if ($row['topic_visibility'] == ITEM_APPROVED)
{
- $forum_data[$forum_id]['topics'] = $row['forum_topics'];
+ $forum_data[$forum_id]['topics_approved'] = $row['total_topics'];
+ }
+ else if ($row['topic_visibility'] == ITEM_UNAPPROVED)
+ {
+ $forum_data[$forum_id]['topics_unapproved'] = $row['total_topics'];
+ }
+ else if ($row['topic_visibility'] == ITEM_DELETED)
+ {
+ $forum_data[$forum_id]['topics_softdeleted'] = $row['total_topics'];
}
}
$db->sql_freeresult($result);
@@ -1722,18 +1744,16 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
{
if (sizeof($forum_ids) == 1)
{
- $sql = 'SELECT SUM(t.topic_replies + 1) AS forum_posts
+ $sql = 'SELECT SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted
FROM ' . TOPICS_TABLE . ' t
WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . '
- AND t.topic_approved = 1
AND t.topic_status <> ' . ITEM_MOVED;
}
else
{
- $sql = 'SELECT t.forum_id, SUM(t.topic_replies + 1) AS forum_posts
+ $sql = 'SELECT t.forum_id, SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted
FROM ' . TOPICS_TABLE . ' t
WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . '
- AND t.topic_approved = 1
AND t.topic_status <> ' . ITEM_MOVED . '
GROUP BY t.forum_id';
}
@@ -1744,7 +1764,9 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
{
$forum_id = (sizeof($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id'];
- $forum_data[$forum_id]['posts'] = (int) $row['forum_posts'];
+ $forum_data[$forum_id]['posts_approved'] = (int) $row['forum_posts_approved'];
+ $forum_data[$forum_id]['posts_unapproved'] = (int) $row['forum_posts_unapproved'];
+ $forum_data[$forum_id]['posts_softdeleted'] = (int) $row['forum_posts_softdeleted'];
}
$db->sql_freeresult($result);
}
@@ -1755,14 +1777,14 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$sql = 'SELECT MAX(t.topic_last_post_id) as last_post_id
FROM ' . TOPICS_TABLE . ' t
WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . '
- AND t.topic_approved = 1';
+ AND t.topic_visibility = ' . ITEM_APPROVED;
}
else
{
$sql = 'SELECT t.forum_id, MAX(t.topic_last_post_id) as last_post_id
FROM ' . TOPICS_TABLE . ' t
WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . '
- AND t.topic_approved = 1
+ AND t.topic_visibility = ' . ITEM_APPROVED . '
GROUP BY t.forum_id';
}
@@ -1825,7 +1847,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
if ($sync_extra)
{
- array_push($fieldnames, 'posts', 'topics', 'topics_real');
+ array_push($fieldnames, 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'topics_approved', 'topics_unapproved', 'topics_softdeleted');
}
foreach ($forum_data as $forum_id => $row)
@@ -1860,11 +1882,11 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
break;
case 'topic':
- $topic_data = $post_ids = $approved_unapproved_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array();
+ $topic_data = $post_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array();
$db->sql_transaction('begin');
- $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time
+ $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_visibility, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time
FROM ' . TOPICS_TABLE . " t
$where_sql";
$result = $db->sql_query($sql);
@@ -1879,8 +1901,10 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$topic_id = (int) $row['topic_id'];
$topic_data[$topic_id] = $row;
- $topic_data[$topic_id]['replies_real'] = -1;
- $topic_data[$topic_id]['replies'] = 0;
+ $topic_data[$topic_id]['visibility'] = ITEM_UNAPPROVED;
+ $topic_data[$topic_id]['posts_approved'] = 0;
+ $topic_data[$topic_id]['posts_unapproved'] = 0;
+ $topic_data[$topic_id]['posts_softdeleted'] = 0;
$topic_data[$topic_id]['first_post_id'] = 0;
$topic_data[$topic_id]['last_post_id'] = 0;
unset($topic_data[$topic_id]['topic_id']);
@@ -1897,11 +1921,11 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$db->sql_freeresult($result);
// Use "t" as table alias because of the $where_sql clause
- // NOTE: 't.post_approved' in the GROUP BY is causing a major slowdown.
- $sql = 'SELECT t.topic_id, t.post_approved, COUNT(t.post_id) AS total_posts, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id
+ // NOTE: 't.post_visibility' in the GROUP BY is causing a major slowdown.
+ $sql = 'SELECT t.topic_id, t.post_visibility, COUNT(t.post_id) AS total_posts, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id
FROM ' . POSTS_TABLE . " t
$where_sql
- GROUP BY t.topic_id, t.post_approved";
+ GROUP BY t.topic_id, t.post_visibility";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -1922,14 +1946,38 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
// When we'll be done, only topics with no posts will remain
unset($delete_topics[$topic_id]);
- $topic_data[$topic_id]['replies_real'] += $row['total_posts'];
- $topic_data[$topic_id]['first_post_id'] = (!$topic_data[$topic_id]['first_post_id']) ? $row['first_post_id'] : min($topic_data[$topic_id]['first_post_id'], $row['first_post_id']);
+ if ($row['post_visibility'] == ITEM_APPROVED)
+ {
+ $topic_data[$topic_id]['posts_approved'] = $row['total_posts'];
+ }
+ else if ($row['post_visibility'] == ITEM_UNAPPROVED)
+ {
+ $topic_data[$topic_id]['posts_unapproved'] = $row['total_posts'];
+ }
+ else if ($row['post_visibility'] == ITEM_DELETED)
+ {
+ $topic_data[$topic_id]['posts_softdeleted'] = $row['total_posts'];
+ }
- if ($row['post_approved'] || !$topic_data[$topic_id]['last_post_id'])
+ if ($row['post_visibility'] == ITEM_APPROVED)
{
- $topic_data[$topic_id]['replies'] = $row['total_posts'] - 1;
+ $topic_data[$topic_id]['visibility'] = ITEM_APPROVED;
+ $topic_data[$topic_id]['first_post_id'] = $row['first_post_id'];
$topic_data[$topic_id]['last_post_id'] = $row['last_post_id'];
}
+ else if ($topic_data[$topic_id]['visibility'] != ITEM_APPROVED)
+ {
+ // If there is no approved post, we take the min/max of the other visibilities
+ // for the last and first post info, because it is only visible to moderators anyway
+ $topic_data[$topic_id]['first_post_id'] = (!empty($topic_data[$topic_id]['first_post_id'])) ? min($topic_data[$topic_id]['first_post_id'], $row['first_post_id']) : $row['first_post_id'];
+ $topic_data[$topic_id]['last_post_id'] = max($topic_data[$topic_id]['last_post_id'], $row['last_post_id']);
+
+ if ($topic_data[$topic_id]['visibility'] == ITEM_UNAPPROVED)
+ {
+ // Soft delete status is stronger than unapproved.
+ $topic_data[$topic_id]['visibility'] = $row['post_visibility'];
+ }
+ }
}
}
$db->sql_freeresult($result);
@@ -1970,7 +2018,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
unset($delete_topics, $delete_topic_ids);
}
- $sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour
+ $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '
AND u.user_id = p.poster_id';
@@ -1983,10 +2031,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
if ($row['post_id'] == $topic_data[$topic_id]['first_post_id'])
{
- if ($topic_data[$topic_id]['topic_approved'] != $row['post_approved'])
- {
- $approved_unapproved_ids[] = $topic_id;
- }
$topic_data[$topic_id]['time'] = $row['post_time'];
$topic_data[$topic_id]['poster'] = $row['poster_id'];
$topic_data[$topic_id]['first_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username'];
@@ -2047,7 +2091,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$sync_shadow_topics = array();
if (sizeof($post_ids))
{
- $sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour
+ $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '
AND u.user_id = p.poster_id';
@@ -2114,18 +2158,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
unset($sync_shadow_topics, $shadow_topic_data);
}
- // approved becomes unapproved, and vice-versa
- if (sizeof($approved_unapproved_ids))
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . '
- SET topic_approved = 1 - topic_approved
- WHERE ' . $db->sql_in_set('topic_id', $approved_unapproved_ids);
- $db->sql_query($sql);
- }
- unset($approved_unapproved_ids);
-
// These are fields that will be synchronised
- $fieldnames = array('time', 'replies', 'replies_real', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour');
+ $fieldnames = array('time', 'visibility', 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour');
if ($sync_extra)
{
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index ac791e0d9b..a34a193f60 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1768,7 +1768,7 @@ function sync_post_count($offset, $limit)
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
FROM ' . POSTS_TABLE . '
WHERE post_postcount = 1
- AND post_approved = 1
+ AND post_visibility = ' . ITEM_APPROVED . '
GROUP BY poster_id
ORDER BY poster_id';
$result = $db->sql_query_limit($sql, $limit, $offset);
@@ -1941,7 +1941,7 @@ function update_dynamic_config()
$sql = 'SELECT COUNT(post_id) AS stat
FROM ' . POSTS_TABLE . '
- WHERE post_approved = 1';
+ WHERE post_visibility = ' . ITEM_APPROVED;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -1950,7 +1950,7 @@ function update_dynamic_config()
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
- WHERE topic_approved = 1';
+ WHERE topic_visibility = ' . ITEM_APPROVED;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 9854cd6d70..b1dac64bec 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -22,7 +22,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
{
global $db, $auth, $user, $template;
global $phpbb_root_path, $phpEx, $config;
- global $request, $phpbb_dispatcher;
+ global $request, $phpbb_dispatcher, $phpbb_container;
$forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array();
$parent_id = $visible_forums = 0;
@@ -149,6 +149,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$forum_tracking_info = array();
$branch_root_id = $root_data['forum_id'];
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
while ($row = $db->sql_fetchrow($result))
{
/**
@@ -213,9 +215,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$forum_tracking_info[$forum_id] = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark'];
}
- // Count the difference of real to public topics, so we can display an information to moderators
- $row['forum_id_unapproved_topics'] = ($auth->acl_get('m_approve', $forum_id) && ($row['forum_topics_real'] != $row['forum_topics'])) ? $forum_id : 0;
- $row['forum_topics'] = ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics'];
+ // Lets check whether there are unapproved topics/posts, so we can display an information to moderators
+ $row['forum_id_unapproved_topics'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_topics_unapproved']) ? $forum_id : 0;
+ $row['forum_id_unapproved_posts'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_posts_unapproved']) ? $forum_id : 0;
+ $row['forum_posts'] = $phpbb_content_visibility->get_count('forum_posts', $row, $forum_id);
+ $row['forum_topics'] = $phpbb_content_visibility->get_count('forum_topics', $row, $forum_id);
// Display active topics from this forum?
if ($show_active && $row['forum_type'] == FORUM_POST && $auth->acl_get('f_read', $forum_id) && ($row['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS))
@@ -278,6 +282,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$forum_rows[$parent_id]['forum_id_unapproved_topics'] = $forum_id;
}
+ if (!$forum_rows[$parent_id]['forum_id_unapproved_posts'] && $row['forum_id_unapproved_posts'])
+ {
+ $forum_rows[$parent_id]['forum_id_unapproved_posts'] = $forum_id;
+ }
+
$forum_rows[$parent_id]['forum_topics'] += $row['forum_topics'];
// Do not list redirects in LINK Forums as Posts.
@@ -545,6 +554,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'L_MODERATOR_STR' => $l_moderator,
'U_UNAPPROVED_TOPICS' => ($row['forum_id_unapproved_topics']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=unapproved_topics&amp;f=' . $row['forum_id_unapproved_topics']) : '',
+ 'U_UNAPPROVED_POSTS' => ($row['forum_id_unapproved_posts']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=unapproved_posts&amp;f=' . $row['forum_id_unapproved_posts']) : '',
'U_VIEWFORUM' => $u_viewforum,
'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
'U_LAST_POST' => $last_post_url,
@@ -584,6 +594,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'],
'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPICS_UNAPPROVED'),
+ 'UNAPPROVED_POST_IMG' => $user->img('icon_topic_unapproved', 'POSTS_UNAPPROVED'),
));
if ($return_moderators)
@@ -815,7 +826,7 @@ function gen_forum_auth_level($mode, $forum_id, $forum_status)
($auth->acl_get('f_post', $forum_id) && !$locked) ? $user->lang['RULES_POST_CAN'] : $user->lang['RULES_POST_CANNOT'],
($auth->acl_get('f_reply', $forum_id) && !$locked) ? $user->lang['RULES_REPLY_CAN'] : $user->lang['RULES_REPLY_CANNOT'],
($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id) && !$locked) ? $user->lang['RULES_EDIT_CAN'] : $user->lang['RULES_EDIT_CANNOT'],
- ($user->data['is_registered'] && $auth->acl_gets('f_delete', 'm_delete', $forum_id) && !$locked) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'],
+ ($user->data['is_registered'] && ($auth->acl_gets('f_delete', 'm_delete', $forum_id) || $auth->acl_gets('f_softdelete', 'm_softdelete', $forum_id)) && !$locked) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'],
);
if ($config['allow_attachments'])
@@ -1005,7 +1016,7 @@ function display_reasons($reason_id = 0)
function display_user_activity(&$userdata)
{
global $auth, $template, $db, $user;
- global $phpbb_root_path, $phpEx;
+ global $phpbb_root_path, $phpEx, $phpbb_container;
// Do not display user activity for users having more than 5000 posts...
if ($userdata['user_posts'] > 5000)
@@ -1015,73 +1026,65 @@ function display_user_activity(&$userdata)
$forum_ary = array();
- // Do not include those forums the user is not having read access to...
- $forum_read_ary = $auth->acl_getf('!f_read');
-
- foreach ($forum_read_ary as $forum_id => $not_allowed)
+ $forum_read_ary = $auth->acl_getf('f_read');
+ foreach ($forum_read_ary as $forum_id => $allowed)
{
- if ($not_allowed['f_read'])
+ if ($allowed['f_read'])
{
$forum_ary[] = (int) $forum_id;
}
}
- $forum_ary = array_unique($forum_ary);
- $forum_sql = (sizeof($forum_ary)) ? 'AND ' . $db->sql_in_set('forum_id', $forum_ary, true) : '';
-
- $fid_m_approve = $auth->acl_getf('m_approve', true);
- $sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $db->sql_in_set('forum_id', array_keys($fid_m_approve)) : '';
-
- // Obtain active forum
- $sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
- FROM ' . POSTS_TABLE . '
- WHERE poster_id = ' . $userdata['user_id'] . "
- AND post_postcount = 1
- AND (post_approved = 1
- $sql_m_approve)
- $forum_sql
- GROUP BY forum_id
- ORDER BY num_posts DESC";
- $result = $db->sql_query_limit($sql, 1);
- $active_f_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ $forum_ary = array_diff($forum_ary, $user->get_passworded_forums());
- if (!empty($active_f_row))
+ $active_f_row = $active_t_row = array();
+ if (!empty($forum_ary))
{
- $sql = 'SELECT forum_name
- FROM ' . FORUMS_TABLE . '
- WHERE forum_id = ' . $active_f_row['forum_id'];
- $result = $db->sql_query($sql, 3600);
- $active_f_row['forum_name'] = (string) $db->sql_fetchfield('forum_name');
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
+ // Obtain active forum
+ $sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
+ FROM ' . POSTS_TABLE . '
+ WHERE poster_id = ' . $userdata['user_id'] . '
+ AND post_postcount = 1
+ AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . '
+ GROUP BY forum_id
+ ORDER BY num_posts DESC';
+ $result = $db->sql_query_limit($sql, 1);
+ $active_f_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- }
- // Obtain active topic
- // We need to exclude passworded forums here so we do not leak the topic title
- $forum_ary_topic = array_unique(array_merge($forum_ary, $user->get_passworded_forums()));
- $forum_sql_topic = (!empty($forum_ary_topic)) ? 'AND ' . $db->sql_in_set('forum_id', $forum_ary_topic, true) : '';
-
- $sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
- FROM ' . POSTS_TABLE . '
- WHERE poster_id = ' . $userdata['user_id'] . "
- AND post_postcount = 1
- AND (post_approved = 1
- $sql_m_approve)
- $forum_sql_topic
- GROUP BY topic_id
- ORDER BY num_posts DESC";
- $result = $db->sql_query_limit($sql, 1);
- $active_t_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ if (!empty($active_f_row))
+ {
+ $sql = 'SELECT forum_name
+ FROM ' . FORUMS_TABLE . '
+ WHERE forum_id = ' . $active_f_row['forum_id'];
+ $result = $db->sql_query($sql, 3600);
+ $active_f_row['forum_name'] = (string) $db->sql_fetchfield('forum_name');
+ $db->sql_freeresult($result);
+ }
- if (!empty($active_t_row))
- {
- $sql = 'SELECT topic_title
- FROM ' . TOPICS_TABLE . '
- WHERE topic_id = ' . $active_t_row['topic_id'];
- $result = $db->sql_query($sql);
- $active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title');
+ // Obtain active topic
+ $sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
+ FROM ' . POSTS_TABLE . '
+ WHERE poster_id = ' . $userdata['user_id'] . '
+ AND post_postcount = 1
+ AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . '
+ GROUP BY topic_id
+ ORDER BY num_posts DESC';
+ $result = $db->sql_query_limit($sql, 1);
+ $active_t_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
+
+ if (!empty($active_t_row))
+ {
+ $sql = 'SELECT topic_title
+ FROM ' . TOPICS_TABLE . '
+ WHERE topic_id = ' . $active_t_row['topic_id'];
+ $result = $db->sql_query($sql);
+ $active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title');
+ $db->sql_freeresult($result);
+ }
}
$userdata['active_t_row'] = $active_t_row;
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 8978e3fadd..bd0ffaaf00 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -184,12 +184,6 @@ function dbms_select($default = '', $only_20x_options = false)
*/
function get_tables(&$db)
{
- if (!class_exists('phpbb_db_tools'))
- {
- global $phpbb_root_path, $phpEx;
- require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx);
- }
-
$db_tools = new phpbb_db_tools($db);
return $db_tools->sql_list_tables();
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index b9b518ad32..103cc81205 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -176,7 +176,7 @@ function update_post_information($type, $ids, $return_update_sql = false)
if ($type != 'topic')
{
$topic_join = ', ' . TOPICS_TABLE . ' t';
- $topic_condition = 'AND t.topic_id = p.topic_id AND t.topic_approved = 1';
+ $topic_condition = 'AND t.topic_id = p.topic_id AND t.topic_visibility = ' . ITEM_APPROVED;
}
else
{
@@ -190,7 +190,7 @@ function update_post_information($type, $ids, $return_update_sql = false)
FROM ' . POSTS_TABLE . " p $topic_join
WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . "
$topic_condition
- AND p.post_approved = 1";
+ AND p.post_visibility = " . ITEM_APPROVED;
}
else
{
@@ -198,7 +198,7 @@ function update_post_information($type, $ids, $return_update_sql = false)
FROM ' . POSTS_TABLE . " p $topic_join
WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . "
$topic_condition
- AND p.post_approved = 1
+ AND p.post_visibility = " . ITEM_APPROVED . "
GROUP BY p.{$type}_id";
}
$result = $db->sql_query($sql);
@@ -982,13 +982,15 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
{
global $user, $auth, $db, $template, $bbcode, $cache;
- global $config, $phpbb_root_path, $phpEx;
+ global $config, $phpbb_root_path, $phpEx, $phpbb_container;
+
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
// Go ahead and pull all data for this topic
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p' . "
WHERE p.topic_id = $topic_id
- " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . '
+ AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . '
' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . '
' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . '
ORDER BY p.post_time ';
@@ -1175,14 +1177,14 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
/**
* Delete Post
*/
-function delete_post($forum_id, $topic_id, $post_id, &$data)
+function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '')
{
- global $db, $user, $auth;
+ global $db, $user, $auth, $phpbb_container;
global $config, $phpEx, $phpbb_root_path;
// Specify our post mode
$post_mode = 'delete';
- if (($data['topic_first_post_id'] === $data['topic_last_post_id']) && $data['topic_replies_real'] == 0)
+ if (($data['topic_first_post_id'] === $data['topic_last_post_id']) && ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1))
{
$post_mode = 'delete_topic';
}
@@ -1224,20 +1226,30 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$db->sql_freeresult($result);
}
- if (!delete_posts('post_id', array($post_id), false, false))
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
+ // (Soft) delete the post
+ if ($is_soft && ($post_mode != 'delete_topic'))
+ {
+ $phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason, ($data['topic_first_post_id'] == $post_id), ($data['topic_last_post_id'] == $post_id));
+ }
+ else if (!$is_soft)
{
- // Try to delete topic, we may had an previous error causing inconsistency
- if ($post_mode == 'delete_topic')
+ if (!delete_posts('post_id', array($post_id), false, false, false))
{
- delete_topics('topic_id', array($topic_id), false);
+ // Try to delete topic, we may had an previous error causing inconsistency
+ if ($post_mode == 'delete_topic')
+ {
+ delete_topics('topic_id', array($topic_id), false);
+ }
+ trigger_error('ALREADY_DELETED');
}
- trigger_error('ALREADY_DELETED');
}
$db->sql_transaction('commit');
// Collect the necessary information for updating the tables
- $sql_data[FORUMS_TABLE] = '';
+ $sql_data[FORUMS_TABLE] = $sql_data[TOPICS_TABLE] = '';
switch ($post_mode)
{
case 'delete_topic':
@@ -1246,21 +1258,43 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
{
// counting is fun! we only have to do sizeof($forum_ids) number of queries,
// even if the topic is moved back to where its shadow lives (we count how many times it is in a forum)
- $db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_topics_real = forum_topics_real - ' . $topic_count . ', forum_topics = forum_topics - ' . $topic_count . ' WHERE forum_id = ' . $updated_forum);
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET forum_topics_approved = forum_topics_approved - ' . $topic_count . '
+ WHERE forum_id = ' . $updated_forum;
+ $db->sql_query($sql);
update_post_information('forum', $updated_forum);
}
- delete_topics('topic_id', array($topic_id), false);
+ if ($is_soft)
+ {
+ $topic_row = array();
+ $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason);
+ }
+ else
+ {
+ delete_topics('topic_id', array($topic_id), false);
- $sql_data[FORUMS_TABLE] .= 'forum_topics_real = forum_topics_real - 1';
- $sql_data[FORUMS_TABLE] .= ($data['topic_approved']) ? ', forum_posts = forum_posts - 1, forum_topics = forum_topics - 1' : '';
+ if ($data['topic_visibility'] == ITEM_APPROVED)
+ {
+ $sql_data[FORUMS_TABLE] .= 'forum_posts_approved = forum_posts_approved - 1, forum_topics_approved = forum_topics_approved - 1';
+ }
+ else if ($data['topic_visibility'] == ITEM_UNAPPROVED)
+ {
+ $sql_data[FORUMS_TABLE] .= 'forum_posts_unapproved = forum_posts_unapproved - 1, forum_topics_unapproved = forum_topics_unapproved - 1';
+ }
+ else if ($data['topic_visibility'] == ITEM_DELETED)
+ {
+ $sql_data[FORUMS_TABLE] .= 'forum_posts_softdeleted = forum_posts_softdeleted - 1, forum_topics_softdeleted = forum_topics_softdeleted - 1';
+ }
- $update_sql = update_post_information('forum', $forum_id, true);
- if (sizeof($update_sql))
- {
- $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
- $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);
+ $update_sql = update_post_information('forum', $forum_id, true);
+ if (sizeof($update_sql))
+ {
+ $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
+ $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);
+ }
}
+
break;
case 'delete_first_post':
@@ -1268,73 +1302,101 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
- ORDER BY p.post_time ASC";
+ AND p.post_visibility = " . ITEM_APPROVED . '
+ ORDER BY p.post_time ASC';
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- $sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : '';
-
- $sql_data[TOPICS_TABLE] = 'topic_poster = ' . intval($row['poster_id']) . ', topic_first_post_id = ' . intval($row['post_id']) . ", topic_first_poster_colour = '" . $db->sql_escape($row['user_colour']) . "', topic_first_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "', topic_time = " . (int) $row['post_time'];
-
- // Decrementing topic_replies here is fine because this case only happens if there is more than one post within the topic - basically removing one "reply"
- $sql_data[TOPICS_TABLE] .= ', topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : '');
+ if (!$row)
+ {
+ // No approved post, so the first is a not-approved post (unapproved or soft deleted)
+ $sql = 'SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username, u.user_colour
+ FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
+ WHERE p.topic_id = $topic_id
+ AND p.poster_id = u.user_id
+ ORDER BY p.post_time ASC";
+ $result = $db->sql_query_limit($sql, 1);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+ }
$next_post_id = (int) $row['post_id'];
+
+ $sql_data[TOPICS_TABLE] = $db->sql_build_array('UPDATE', array(
+ 'topic_poster' => (int) $row['poster_id'],
+ 'topic_first_post_id' => (int) $row['post_id'],
+ 'topic_first_poster_colour' => $row['user_colour'],
+ 'topic_first_poster_name' => ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username'],
+ 'topic_time' => (int) $row['post_time'],
+ ));
break;
case 'delete_last_post':
- $sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : '';
-
- $update_sql = update_post_information('forum', $forum_id, true);
- if (sizeof($update_sql))
+ if (!$is_soft)
{
- $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
- $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);
- }
+ // Update last post information when hard deleting. Soft delete already did that by itself.
+ $update_sql = update_post_information('forum', $forum_id, true);
+ if (sizeof($update_sql))
+ {
+ $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . implode(', ', $update_sql[$forum_id]);
+ }
- $sql_data[TOPICS_TABLE] = 'topic_bumped = 0, topic_bumper = 0, topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : '');
+ $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_bumped = 0, topic_bumper = 0';
- $update_sql = update_post_information('topic', $topic_id, true);
- if (sizeof($update_sql))
- {
- $sql_data[TOPICS_TABLE] .= ', ' . implode(', ', $update_sql[$topic_id]);
- $next_post_id = (int) str_replace('topic_last_post_id = ', '', $update_sql[$topic_id][0]);
+ $update_sql = update_post_information('topic', $topic_id, true);
+ if (!empty($update_sql))
+ {
+ $sql_data[TOPICS_TABLE] .= ', ' . implode(', ', $update_sql[$topic_id]);
+ $next_post_id = (int) str_replace('topic_last_post_id = ', '', $update_sql[$topic_id][0]);
+ }
}
- else
+
+ if (!$next_post_id)
{
$sql = 'SELECT MAX(post_id) as last_post_id
FROM ' . POSTS_TABLE . "
- WHERE topic_id = $topic_id " .
- ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND post_approved = 1' : '');
+ WHERE topic_id = $topic_id
+ AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id);
$result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
+ $next_post_id = (int) $db->sql_fetchfield('last_post_id');
$db->sql_freeresult($result);
-
- $next_post_id = (int) $row['last_post_id'];
}
break;
case 'delete':
$sql = 'SELECT post_id
FROM ' . POSTS_TABLE . "
- WHERE topic_id = $topic_id " .
- ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND post_approved = 1' : '') . '
+ WHERE topic_id = $topic_id
+ AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . '
AND post_time > ' . $data['post_time'] . '
ORDER BY post_time ASC';
$result = $db->sql_query_limit($sql, 1);
- $row = $db->sql_fetchrow($result);
+ $next_post_id = (int) $db->sql_fetchfield('post_id');
$db->sql_freeresult($result);
-
- $sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : '';
-
- $sql_data[TOPICS_TABLE] = 'topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : '');
- $next_post_id = (int) $row['post_id'];
break;
}
if (($post_mode == 'delete') || ($post_mode == 'delete_last_post') || ($post_mode == 'delete_first_post'))
{
+ if (!$is_soft)
+ {
+ if ($data['post_visibility'] == ITEM_APPROVED)
+ {
+ $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data);
+ }
+ else if ($data['post_visibility'] == ITEM_UNAPPROVED)
+ {
+ $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1';
+ $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1';
+ }
+ else if ($data['post_visibility'] == ITEM_DELETED)
+ {
+ $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1';
+ $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1';
+ }
+ }
+
$sql = 'SELECT 1 AS has_attachments
FROM ' . ATTACHMENTS_TABLE . '
WHERE topic_id = ' . $topic_id;
@@ -1344,18 +1406,16 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
if (!$has_attachments)
{
- $sql_data[TOPICS_TABLE] .= ', topic_attachment = 0';
+ $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_attachment = 0';
}
}
-// $sql_data[USERS_TABLE] = ($data['post_postcount']) ? 'user_posts = user_posts - 1' : '';
-
$db->sql_transaction('begin');
$where_sql = array(
FORUMS_TABLE => "forum_id = $forum_id",
TOPICS_TABLE => "topic_id = $topic_id",
- USERS_TABLE => 'user_id = ' . $data['poster_id']
+ USERS_TABLE => 'user_id = ' . $data['poster_id'],
);
foreach ($sql_data as $table => $update_sql)
@@ -1425,7 +1485,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
else if ($mode == 'edit')
{
- $post_mode = ($data['topic_replies_real'] == 0) ? 'edit_topic' : (($data['topic_first_post_id'] == $data['post_id']) ? 'edit_first_post' : (($data['topic_last_post_id'] == $data['post_id']) ? 'edit_last_post' : 'edit'));
+ $post_mode = ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data['topic_first_post_id'] == $data['post_id']) ? 'edit_first_post' : (($data['topic_last_post_id'] == $data['post_id']) ? 'edit_last_post' : 'edit'));
}
// First of all make sure the subject and topic title are having the correct length.
@@ -1438,9 +1498,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$poster_id = ($mode == 'edit') ? $data['poster_id'] : (int) $user->data['user_id'];
// Retrieve some additional information if not present
- if ($mode == 'edit' && (!isset($data['post_approved']) || !isset($data['topic_approved']) || $data['post_approved'] === false || $data['topic_approved'] === false))
+ if ($mode == 'edit' && (!isset($data['post_visibility']) || !isset($data['topic_visibility']) || $data['post_visibility'] === false || $data['topic_visibility'] === false))
{
- $sql = 'SELECT p.post_approved, t.topic_type, t.topic_replies, t.topic_replies_real, t.topic_approved
+ $sql = 'SELECT p.post_visibility, t.topic_type, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_visibility
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
WHERE t.topic_id = p.topic_id
AND p.post_id = ' . $data['post_id'];
@@ -1448,26 +1508,29 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$topic_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- $data['topic_approved'] = $topic_row['topic_approved'];
- $data['post_approved'] = $topic_row['post_approved'];
+ $data['topic_visibility'] = $topic_row['topic_visibility'];
+ $data['post_visibility'] = $topic_row['post_visibility'];
}
- // This variable indicates if the user is able to post or put into the queue - it is used later for all code decisions regarding approval
- // The variable name should be $post_approved, because it indicates if the post is approved or not
- $post_approval = 1;
+ // This variable indicates if the user is able to post or put into the queue
+ $post_visibility = ITEM_APPROVED;
// Check the permissions for post approval.
// Moderators must go through post approval like ordinary users.
if (!$auth->acl_get('f_noapprove', $data['forum_id']))
{
// Post not approved, but in queue
- $post_approval = 0;
+ $post_visibility = ITEM_UNAPPROVED;
}
- // Mods are able to force approved/unapproved posts. True means the post is approved, false the post is unapproved
+ // MODs/Extensions are able to force any visibility on posts
if (isset($data['force_approved_state']))
{
- $post_approval = ($data['force_approved_state']) ? 1 : 0;
+ $post_visibility = (in_array((int) $data['force_approved_state'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED))) ? (int) $data['force_approved_state'] : $post_visibility;
+ }
+ if (isset($data['force_visibility']))
+ {
+ $post_visibility = (in_array((int) $data['force_visibility'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED))) ? (int) $data['force_visibility'] : $post_visibility;
}
// Start the transaction here
@@ -1484,7 +1547,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'icon_id' => $data['icon_id'],
'poster_ip' => $user->ip,
'post_time' => $current_time,
- 'post_approved' => $post_approval,
+ 'post_visibility' => $post_visibility,
'enable_bbcode' => $data['enable_bbcode'],
'enable_smilies' => $data['enable_smilies'],
'enable_magic_url' => $data['enable_urls'],
@@ -1550,7 +1613,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'forum_id' => $data['forum_id'],
'poster_id' => $data['poster_id'],
'icon_id' => $data['icon_id'],
- 'post_approved' => (!$post_approval) ? 0 : $data['post_approved'],
+ // We will change the visibility later
+ //'post_visibility' => $post_visibility,
'enable_bbcode' => $data['enable_bbcode'],
'enable_smilies' => $data['enable_smilies'],
'enable_magic_url' => $data['enable_urls'],
@@ -1571,8 +1635,6 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
break;
}
-
- $post_approved = $sql_data[POSTS_TABLE]['sql']['post_approved'];
$topic_row = array();
// And the topic ladies and gentlemen
@@ -1585,7 +1647,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'topic_last_view_time' => $current_time,
'forum_id' => $data['forum_id'],
'icon_id' => $data['icon_id'],
- 'topic_approved' => $post_approval,
+ 'topic_posts_approved' => ($post_visibility == ITEM_APPROVED) ? 1 : 0,
+ 'topic_posts_softdeleted' => ($post_visibility == ITEM_DELETED) ? 1 : 0,
+ 'topic_posts_unapproved' => ($post_visibility == ITEM_UNAPPROVED) ? 1 : 0,
+ 'topic_visibility' => $post_visibility,
+ 'topic_delete_user' => ($post_visibility != ITEM_APPROVED) ? (int) $user->data['user_id'] : 0,
'topic_title' => $subject,
'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''),
'topic_first_poster_colour' => $user->data['user_colour'],
@@ -1617,28 +1683,47 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
);
}
- $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_approval) ? ', user_posts = user_posts + 1' : '');
+ $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : '');
- if ($post_approval)
+ if ($post_visibility == ITEM_APPROVED)
{
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts + 1';
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_approved = forum_topics_approved + 1';
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_approved = forum_posts_approved + 1';
+ }
+ else if ($post_visibility == ITEM_UNAPPROVED)
+ {
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_unapproved = forum_topics_unapproved + 1';
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_unapproved = forum_posts_unapproved + 1';
+ }
+ else if ($post_visibility == ITEM_DELETED)
+ {
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_softdeleted = forum_topics_softdeleted + 1';
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_softdeleted = forum_posts_softdeleted + 1';
}
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_real = forum_topics_real + 1' . (($post_approval) ? ', forum_topics = forum_topics + 1' : '');
break;
case 'reply':
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_view_time = ' . $current_time . ',
- topic_replies_real = topic_replies_real + 1,
topic_bumped = 0,
topic_bumper = 0' .
- (($post_approval) ? ', topic_replies = topic_replies + 1' : '') .
+ (($post_visibility == ITEM_APPROVED) ? ', topic_posts_approved = topic_posts_approved + 1' : '') .
+ (($post_visibility == ITEM_UNAPPROVED) ? ', topic_posts_unapproved = topic_posts_unapproved + 1' : '') .
+ (($post_visibility == ITEM_DELETED) ? ', topic_posts_softdeleted = topic_posts_softdeleted + 1' : '') .
((!empty($data['attachment_data']) || (isset($data['topic_attachment']) && $data['topic_attachment'])) ? ', topic_attachment = 1' : '');
- $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_approval) ? ', user_posts = user_posts + 1' : '');
+ $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : '');
- if ($post_approval)
+ if ($post_visibility == ITEM_APPROVED)
+ {
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_approved = forum_posts_approved + 1';
+ }
+ else if ($post_visibility == ITEM_UNAPPROVED)
{
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts + 1';
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_unapproved = forum_posts_unapproved + 1';
+ }
+ else if ($post_visibility == ITEM_DELETED)
+ {
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_softdeleted = forum_posts_softdeleted + 1';
}
break;
@@ -1662,7 +1747,6 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_data[TOPICS_TABLE]['sql'] = array(
'forum_id' => $data['forum_id'],
'icon_id' => $data['icon_id'],
- 'topic_approved' => (!$post_approval) ? 0 : $data['topic_approved'],
'topic_title' => $subject,
'topic_first_poster_name' => $username,
'topic_type' => $topic_type,
@@ -1677,56 +1761,6 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0),
);
- // Correctly set back the topic replies and forum posts... only if the topic was approved before and now gets disapproved
- if (!$post_approval && $data['topic_approved'])
- {
- // Do we need to grab some topic informations?
- if (!sizeof($topic_row))
- {
- $sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_approved
- FROM ' . TOPICS_TABLE . '
- WHERE topic_id = ' . $data['topic_id'];
- $result = $db->sql_query($sql);
- $topic_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
- }
-
- // If this is the only post remaining we do not need to decrement topic_replies.
- // Also do not decrement if first post - then the topic_replies will not be adjusted if approving the topic again.
-
- // If this is an edited topic or the first post the topic gets completely disapproved later on...
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics = forum_topics - 1';
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies'] + 1);
-
- set_config_count('num_topics', -1, true);
- set_config_count('num_posts', ($topic_row['topic_replies'] + 1) * (-1), true);
-
- // Only decrement this post, since this is the one non-approved now
- if ($auth->acl_get('f_postcount', $data['forum_id']))
- {
- $sql_data[USERS_TABLE]['stat'][] = 'user_posts = user_posts - 1';
- }
- }
-
- break;
-
- case 'edit':
- case 'edit_last_post':
-
- // Correctly set back the topic replies and forum posts... but only if the post was approved before.
- if (!$post_approval && $data['post_approved'])
- {
- $sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1, topic_last_view_time = ' . $current_time;
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1';
-
- set_config_count('num_posts', -1, true);
-
- if ($auth->acl_get('f_postcount', $data['forum_id']))
- {
- $sql_data[USERS_TABLE]['stat'][] = 'user_posts = user_posts - 1';
- }
- }
-
break;
}
@@ -1751,27 +1785,48 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if ($post_mode == 'reply')
{
$sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array(
- 'topic_id' => $data['topic_id'])
- );
+ 'topic_id' => $data['topic_id'],
+ ));
}
$sql = 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data[POSTS_TABLE]['sql']);
$db->sql_query($sql);
$data['post_id'] = $db->sql_nextid();
- if ($post_mode == 'post')
+ if ($post_mode == 'post' || $post_visibility == ITEM_APPROVED)
{
$sql_data[TOPICS_TABLE]['sql'] = array(
- 'topic_first_post_id' => $data['post_id'],
'topic_last_post_id' => $data['post_id'],
'topic_last_post_time' => $current_time,
- 'topic_last_poster_id' => (int) $user->data['user_id'],
- 'topic_last_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''),
+ 'topic_last_poster_id' => $sql_data[POSTS_TABLE]['sql']['poster_id'],
+ 'topic_last_poster_name' => ($user->data['user_id'] == ANONYMOUS) ? $sql_data[POSTS_TABLE]['sql']['post_username'] : $user->data['username'],
'topic_last_poster_colour' => $user->data['user_colour'],
'topic_last_post_subject' => (string) $subject,
);
}
+ if ($post_mode == 'post')
+ {
+ $sql_data[TOPICS_TABLE]['sql']['topic_first_post_id'] = $data['post_id'];
+ }
+
+ // Update total post count and forum information
+ if ($post_visibility == ITEM_APPROVED)
+ {
+ if ($post_mode == 'post')
+ {
+ set_config_count('num_topics', 1, true);
+ }
+ set_config_count('num_posts', 1, true);
+
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data['post_id'];
+ $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'";
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . $current_time;
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $user->data['user_id'];
+ $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape((!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '')) . "'";
+ $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($user->data['user_colour']) . "'";
+ }
+
unset($sql_data[POSTS_TABLE]['sql']);
}
@@ -1782,6 +1837,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
SET ' . $db->sql_build_array('UPDATE', $sql_data[TOPICS_TABLE]['sql']) . '
WHERE topic_id = ' . $data['topic_id'];
$db->sql_query($sql);
+
+ unset($sql_data[TOPICS_TABLE]['sql']);
}
// Update the posts table
@@ -1791,6 +1848,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
SET ' . $db->sql_build_array('UPDATE', $sql_data[POSTS_TABLE]['sql']) . '
WHERE post_id = ' . $data['post_id'];
$db->sql_query($sql);
+
+ unset($sql_data[POSTS_TABLE]['sql']);
}
// Update Poll Tables
@@ -1936,114 +1995,25 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
}
- // we need to update the last forum information
- // only applicable if the topic is approved
- if ($post_approved || !$data['post_approved'])
+ $first_post_has_topic_info = ($post_mode == 'edit_first_post' &&
+ (($post_visibility == ITEM_DELETED && $data['topic_posts_softdeleted'] == 1) ||
+ ($post_visibility == ITEM_UNAPPROVED && $data['topic_posts_unapproved'] == 1) ||
+ ($post_visibility == ITEM_APPROVED && $data['topic_posts_approved'] == 1)));
+ // Fix the post's and topic's visibility and first/last post information, when the post is edited
+ if (($post_mode != 'post' && $post_mode != 'reply') && $data['post_visibility'] != $post_visibility)
{
- // the last post makes us update the forum table. This can happen if...
- // We make a new topic
- // We reply to a topic
- // We edit the last post in a topic and this post is the latest in the forum (maybe)
- // We edit the only post in the topic
- // We edit the first post in the topic and all the other posts are not approved
- if (($post_mode == 'post' || $post_mode == 'reply') && $post_approved)
- {
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data['post_id'];
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'";
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . $current_time;
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $user->data['user_id'];
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape((!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '')) . "'";
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($user->data['user_colour']) . "'";
- }
- else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
- {
- // this does not _necessarily_ mean that we must update the info again,
- // it just means that we might have to
- $sql = 'SELECT forum_last_post_id, forum_last_post_subject
- FROM ' . FORUMS_TABLE . '
- WHERE forum_id = ' . (int) $data['forum_id'];
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ // If the post was not approved, it could also be the starter,
+ // so we sync the starter after approving/restoring, to ensure that the stats are correct
+ // Same applies for the last post
+ $is_starter = ($post_mode == 'edit_first_post' || $data['post_visibility'] != ITEM_APPROVED);
+ $is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data['post_visibility'] != ITEM_APPROVED);
- // this post is the latest post in the forum, better update
- if ($row['forum_last_post_id'] == $data['post_id'])
- {
- // If post approved and subject changed, or poster is anonymous, we need to update the forum_last* rows
- if ($post_approved && ($row['forum_last_post_subject'] !== $subject || $data['poster_id'] == ANONYMOUS))
- {
- // the post's subject changed
- if ($row['forum_last_post_subject'] !== $subject)
- {
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_subject = \'' . $db->sql_escape($subject) . '\'';
- }
-
- // Update the user name if poster is anonymous... just in case an admin changed it
- if ($data['poster_id'] == ANONYMOUS)
- {
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape($username) . "'";
- }
- }
- else if ($data['post_approved'] !== $post_approved)
- {
- // we need a fresh change of socks, everything has become invalidated
- $sql = 'SELECT MAX(topic_last_post_id) as last_post_id
- FROM ' . TOPICS_TABLE . '
- WHERE forum_id = ' . (int) $data['forum_id'] . '
- AND topic_approved = 1';
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // any posts left in this forum?
- if (!empty($row['last_post_id']))
- {
- $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour
- FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
- WHERE p.poster_id = u.user_id
- AND p.post_id = ' . (int) $row['last_post_id'];
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // salvation, a post is found! jam it into the forums table
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . (int) $row['post_id'];
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . (int) $row['post_time'];
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $row['poster_id'];
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
- }
- else
- {
- // just our luck, the last topic in the forum has just been turned unapproved...
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = 0';
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = ''";
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = 0';
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = 0';
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = ''";
- $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = ''";
- }
- }
- }
- }
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+ $phpbb_content_visibility->set_post_visibility($post_visibility, $data['post_id'], $data['topic_id'], $data['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest);
}
-
- // topic sync time!
- // simply, we update if it is a reply or the last post is edited
- if ($post_approved)
+ else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_has_topic_info)
{
- // reply requires the whole thing
- if ($post_mode == 'reply')
- {
- $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_id = ' . (int) $data['post_id'];
- $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_poster_id = ' . (int) $user->data['user_id'];
- $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape((!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '')) . "'";
- $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_colour = '" . (($user->data['user_id'] != ANONYMOUS) ? $db->sql_escape($user->data['user_colour']) : '') . "'";
- $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'";
- $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_time = ' . (int) $current_time;
- }
- else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
+ if ($post_visibility == ITEM_APPROVED || $data['topic_visibility'] == $post_visibility)
{
// only the subject can be changed from edit
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'";
@@ -2053,57 +2023,44 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape($username) . "'";
}
- }
- }
- else if (!$data['post_approved'] && ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies'])))
- {
- // like having the rug pulled from under us
- $sql = 'SELECT MAX(post_id) as last_post_id
- FROM ' . POSTS_TABLE . '
- WHERE topic_id = ' . (int) $data['topic_id'] . '
- AND post_approved = 1';
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- // any posts left in this forum?
- if (!empty($row['last_post_id']))
- {
- $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour
- FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
- WHERE p.poster_id = u.user_id
- AND p.post_id = ' . (int) $row['last_post_id'];
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
- // salvation, a post is found! jam it into the topics table
- $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_id = ' . (int) $row['post_id'];
- $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
- $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_time = ' . (int) $row['post_time'];
- $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_poster_id = ' . (int) $row['poster_id'];
- $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
- $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
- }
- }
+ if ($post_visibility == ITEM_APPROVED)
+ {
+ // this does not _necessarily_ mean that we must update the info again,
+ // it just means that we might have to
+ $sql = 'SELECT forum_last_post_id, forum_last_post_subject
+ FROM ' . FORUMS_TABLE . '
+ WHERE forum_id = ' . (int) $data['forum_id'];
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- // Update total post count, do not consider moderated posts/topics
- if ($post_approval)
- {
- if ($post_mode == 'post')
- {
- set_config_count('num_topics', 1, true);
- set_config_count('num_posts', 1, true);
- }
+ // this post is the latest post in the forum, better update
+ if ($row['forum_last_post_id'] == $data['post_id'] && ($row['forum_last_post_subject'] !== $subject || $data['poster_id'] == ANONYMOUS))
+ {
+ // the post's subject changed
+ if ($row['forum_last_post_subject'] !== $subject)
+ {
+ $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'";
+ }
- if ($post_mode == 'reply')
- {
- set_config_count('num_posts', 1, true);
+ // Update the user name if poster is anonymous... just in case a moderator changed it
+ if ($data['poster_id'] == ANONYMOUS)
+ {
+ $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape($username) . "'";
+ }
+ }
+ }
}
}
// Update forum stats
- $where_sql = array(POSTS_TABLE => 'post_id = ' . $data['post_id'], TOPICS_TABLE => 'topic_id = ' . $data['topic_id'], FORUMS_TABLE => 'forum_id = ' . $data['forum_id'], USERS_TABLE => 'user_id = ' . $poster_id);
+ $where_sql = array(
+ POSTS_TABLE => 'post_id = ' . $data['post_id'],
+ TOPICS_TABLE => 'topic_id = ' . $data['topic_id'],
+ FORUMS_TABLE => 'forum_id = ' . $data['forum_id'],
+ USERS_TABLE => 'user_id = ' . $poster_id
+ );
foreach ($sql_data as $table => $update_ary)
{
@@ -2226,7 +2183,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$phpbb_notifications = $phpbb_container->get('notification_manager');
- if ($post_approval)
+ if ($post_visibility == ITEM_APPROVED)
{
switch ($mode)
{
@@ -2259,7 +2216,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
break;
}
}
- else
+ else if ($post_visibility == ITEM_UNAPPROVED)
{
switch ($mode)
{
@@ -2276,6 +2233,32 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'edit_first_post':
case 'edit':
case 'edit_last_post':
+ // @todo: Check whether these notification deletions are correct
+ $phpbb_notifications->delete_notifications('topic', $data['topic_id']);
+
+ $phpbb_notifications->delete_notifications(array(
+ 'quote',
+ 'bookmark',
+ 'post',
+ ), $data['post_id']);
+ break;
+ }
+ }
+ else if ($post_visibility == ITEM_DELETED)
+ {
+ switch ($mode)
+ {
+ case 'post':
+ case 'reply':
+ case 'quote':
+ // Nothing to do here
+ break;
+
+ case 'edit_topic':
+ case 'edit_first_post':
+ case 'edit':
+ case 'edit_last_post':
+ // @todo: Check whether these notification deletions are correct
$phpbb_notifications->delete_notifications('topic', $data['topic_id']);
$phpbb_notifications->delete_notifications(array(
@@ -2289,7 +2272,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$params = $add_anchor = '';
- if ($post_approval)
+ if ($post_visibility == ITEM_APPROVED)
{
$params .= '&amp;t=' . $data['topic_id'];
diff --git a/phpBB/includes/mcp/info/mcp_queue.php b/phpBB/includes/mcp/info/mcp_queue.php
index 7ad79f9781..68cac5abd2 100644
--- a/phpBB/includes/mcp/info/mcp_queue.php
+++ b/phpBB/includes/mcp/info/mcp_queue.php
@@ -21,6 +21,8 @@ class mcp_queue_info
'modes' => array(
'unapproved_topics' => array('title' => 'MCP_QUEUE_UNAPPROVED_TOPICS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
'unapproved_posts' => array('title' => 'MCP_QUEUE_UNAPPROVED_POSTS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
+ 'deleted_topics' => array('title' => 'MCP_QUEUE_DELETED_TOPICS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
+ 'deleted_posts' => array('title' => 'MCP_QUEUE_DELETED_POSTS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
'approve_details' => array('title' => 'MCP_QUEUE_APPROVE_DETAILS', 'auth' => 'acl_m_approve,$id || (!$id && aclf_m_approve)', 'cat' => array('MCP_QUEUE')),
),
);
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 0fad9e2a22..841a0afddb 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -22,7 +22,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
{
global $template, $db, $user, $auth, $cache, $module;
global $phpEx, $phpbb_root_path, $config;
- global $request, $phpbb_dispatcher;
+ global $request, $phpbb_dispatcher, $phpbb_container;
$user->add_lang(array('viewtopic', 'viewforum'));
@@ -98,7 +98,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$sort_by_sql = $sort_order_sql = array();
mcp_sorting('viewforum', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id);
- $forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
+ $forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total;
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
$base_url = $url . "&amp;i=$id&amp;action=$action&amp;mode=$mode&amp;sd=$sort_dir&amp;sk=$sort_key&amp;st=$sort_days" . (($merge_select) ? $selected_ids : '');
@@ -116,6 +116,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'S_CAN_REPORT' => $auth->acl_get('m_report', $forum_id),
'S_CAN_DELETE' => $auth->acl_get('m_delete', $forum_id),
+ 'S_CAN_RESTORE' => $auth->acl_get('m_approve', $forum_id),
'S_CAN_MERGE' => $auth->acl_get('m_merge', $forum_id),
'S_CAN_MOVE' => $auth->acl_get('m_move', $forum_id),
'S_CAN_FORK' => $auth->acl_get('m_', $forum_id),
@@ -151,10 +152,12 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$read_tracking_join = $read_tracking_select = '';
}
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
$sql = 'SELECT t.topic_id
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id = ' . $forum_id . '
- ' . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
+ AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . "
$limit_time_sql
ORDER BY t.topic_type DESC, $sort_order_sql";
$result = $db->sql_query_limit($sql, $topics_per_page, $start);
@@ -203,7 +206,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$row = &$topic_rows[$topic_id];
- $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
+ $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
if ($row['topic_status'] == ITEM_MOVED)
{
@@ -220,9 +223,11 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$topic_title = censor_text($row['topic_title']);
- $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
- $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
+ $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
+ $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
+ $topic_deleted = $row['topic_visibility'] == ITEM_DELETED;
$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&amp;i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&amp;t=' . $row['topic_id'] : '';
+ $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? $url . '&amp;i=queue&amp;mode=deleted_topics&amp;t=' . $topic_id : $u_mcp_queue;
$topic_row = array(
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
@@ -232,6 +237,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
+ 'DELETED_IMG' => ($topic_deleted) ? $user->img('icon_topic_deleted', 'POSTS_DELETED') : '',
'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
@@ -245,7 +251,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'TOPIC_TYPE' => $topic_type,
'TOPIC_TITLE' => $topic_title,
- 'REPLIES' => ($auth->acl_get('m_approve', $row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'],
+ 'REPLIES' => $phpbb_content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1,
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
'LAST_POST_SUBJECT' => $row['topic_last_post_subject'],
@@ -254,6 +260,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && empty($row['topic_moved_id']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
'S_POSTS_UNAPPROVED' => $posts_unapproved,
+ 'S_TOPIC_DELETED' => $topic_deleted,
'S_UNREAD_TOPIC' => $unread_topic,
);
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index ba4b15895a..44cab5d910 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -39,7 +39,7 @@ function mcp_front_view($id, $mode, $action)
$sql = 'SELECT COUNT(post_id) AS total
FROM ' . POSTS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
- AND post_approved = 0';
+ AND post_visibility = ' . ITEM_UNAPPROVED;
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
$db->sql_freeresult($result);
@@ -60,7 +60,7 @@ function mcp_front_view($id, $mode, $action)
$sql = 'SELECT post_id
FROM ' . POSTS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
- AND post_approved = 0
+ AND post_visibility = ' . ITEM_UNAPPROVED . '
ORDER BY post_time DESC';
$result = $db->sql_query_limit($sql, 5);
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index c28b466bcf..275edbe55a 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -33,7 +33,7 @@ class mcp_main
function main($id, $mode)
{
global $auth, $db, $user, $template, $action;
- global $config, $phpbb_root_path, $phpEx;
+ global $config, $phpbb_root_path, $phpEx, $request;
$quickmod = ($mode == 'quickmod') ? true : false;
@@ -108,27 +108,48 @@ class mcp_main
case 'delete_topic':
$user->add_lang('viewtopic');
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
+ // f parameter is not reliable for permission usage, however we just use it to decide
+ // which permission we will check later on. So if it is manipulated, we will still catch it later on.
+ $forum_id = $request->variable('f', 0);
+ $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
+ $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;
if (!sizeof($topic_ids))
{
trigger_error('NO_TOPIC_SELECTED');
}
- mcp_delete_topic($topic_ids);
+ mcp_delete_topic($topic_ids, $soft_delete, ($soft_delete) ? $request->variable('delete_reason', '', true) : '');
break;
case 'delete_post':
$user->add_lang('posting');
- $post_ids = (!$quickmod) ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
+ // f parameter is not reliable for permission usage, however we just use it to decide
+ // which permission we will check later on. So if it is manipulated, we will still catch it later on.
+ $forum_id = $request->variable('f', 0);
+ $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
+ $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;
if (!sizeof($post_ids))
{
trigger_error('NO_POST_SELECTED');
}
- mcp_delete_post($post_ids);
+ mcp_delete_post($post_ids, $soft_delete, ($soft_delete) ? $request->variable('delete_reason', '', true) : '');
+ break;
+
+ case 'restore_topic':
+ $user->add_lang('posting');
+
+ $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
+
+ if (!sizeof($topic_ids))
+ {
+ trigger_error('NO_TOPIC_SELECTED');
+ }
+
+ mcp_restore_topic($topic_ids);
break;
}
@@ -455,59 +476,30 @@ function mcp_move_topic($topic_ids)
$forum_sync_data[$forum_id] = current($topic_data);
$forum_sync_data[$to_forum_id] = $forum_data;
- // Real topics added to target forum
- $topics_moved = sizeof($topic_data);
-
- // Approved topics added to target forum
- $topics_authed_moved = 0;
-
- // Posts (topic replies + topic post if approved) added to target forum
- $topic_posts_added = 0;
-
- // Posts (topic replies + topic post if approved and not global announcement) removed from source forum
- $topic_posts_removed = 0;
-
- // Real topics removed from source forum (all topics without global announcements)
- $topics_removed = 0;
-
- // Approved topics removed from source forum (except global announcements)
- $topics_authed_removed = 0;
+ $topics_moved = $topics_moved_unapproved = $topics_moved_softdeleted = 0;
+ $posts_moved = $posts_moved_unapproved = $posts_moved_softdeleted = 0;
foreach ($topic_data as $topic_id => $topic_info)
{
- if ($topic_info['topic_approved'])
+ if ($topic_info['topic_visibility'] == ITEM_APPROVED)
{
- $topics_authed_moved++;
- $topic_posts_added++;
+ $topics_moved++;
}
-
- $topic_posts_added += $topic_info['topic_replies'];
-
- $topics_removed++;
- $topic_posts_removed += $topic_info['topic_replies'];
-
- if ($topic_info['topic_approved'])
+ elseif ($topic_info['topic_visibility'] == ITEM_UNAPPROVED)
{
- $topics_authed_removed++;
- $topic_posts_removed++;
+ $topics_moved_unapproved++;
+ }
+ elseif ($topic_info['topic_visibility'] == ITEM_DELETED)
+ {
+ $topics_moved_softdeleted++;
}
- }
-
- $db->sql_transaction('begin');
-
- $sync_sql = array();
-
- if ($topic_posts_added)
- {
- $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . $topic_posts_added;
- }
- if ($topics_authed_moved)
- {
- $sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . (int) $topics_authed_moved;
+ $posts_moved += $topic_info['topic_posts_approved'];
+ $posts_moved_unapproved += $topic_info['topic_posts_unapproved'];
+ $posts_moved_softdeleted += $topic_info['topic_posts_softdeleted'];
}
- $sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . (int) $topics_moved;
+ $db->sql_transaction('begin');
// Move topics, but do not resync yet
move_topics($topic_ids, $to_forum_id, false);
@@ -520,6 +512,7 @@ function mcp_move_topic($topic_ids)
$db->sql_query($sql);
}
+ $shadow_topics = 0;
$forum_ids = array($to_forum_id);
foreach ($topic_data as $topic_id => $row)
{
@@ -528,21 +521,22 @@ function mcp_move_topic($topic_ids)
add_log('mod', $to_forum_id, $topic_id, 'LOG_MOVE', $row['forum_name'], $forum_data['forum_name']);
// Leave a redirection if required and only if the topic is visible to users
- if ($leave_shadow && $row['topic_approved'] && $row['topic_type'] != POST_GLOBAL)
+ if ($leave_shadow && $row['topic_visibility'] == ITEM_APPROVED && $row['topic_type'] != POST_GLOBAL)
{
$shadow = array(
'forum_id' => (int) $row['forum_id'],
'icon_id' => (int) $row['icon_id'],
'topic_attachment' => (int) $row['topic_attachment'],
- 'topic_approved' => 1, // a shadow topic is always approved
+ 'topic_visibility' => ITEM_APPROVED, // a shadow topic is always approved
'topic_reported' => 0, // a shadow topic is never reported
'topic_title' => (string) $row['topic_title'],
'topic_poster' => (int) $row['topic_poster'],
'topic_time' => (int) $row['topic_time'],
'topic_time_limit' => (int) $row['topic_time_limit'],
'topic_views' => (int) $row['topic_views'],
- 'topic_replies' => (int) $row['topic_replies'],
- 'topic_replies_real' => (int) $row['topic_replies_real'],
+ 'topic_posts_approved' => (int) $row['topic_posts_approved'],
+ 'topic_posts_unapproved'=> (int) $row['topic_posts_unapproved'],
+ 'topic_posts_softdeleted'=> (int) $row['topic_posts_softdeleted'],
'topic_status' => ITEM_MOVED,
'topic_type' => POST_NORMAL,
'topic_first_post_id' => (int) $row['topic_first_post_id'],
@@ -568,25 +562,45 @@ function mcp_move_topic($topic_ids)
$db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));
// Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts
- $topics_removed--;
- $topics_authed_removed--;
+ $shadow_topics++;
}
}
unset($topic_data);
- if ($topic_posts_removed)
+ $sync_sql = array();
+ if ($posts_moved)
{
- $sync_sql[$forum_id][] = 'forum_posts = forum_posts - ' . $topic_posts_removed;
+ $sync_sql[$to_forum_id][] = 'forum_posts_approved = forum_posts_approved + ' . (int) $posts_moved;
+ $sync_sql[$forum_id][] = 'forum_posts_approved = forum_posts_approved - ' . (int) $posts_moved;
}
-
- if ($topics_removed)
+ if ($posts_moved_unapproved)
+ {
+ $sync_sql[$to_forum_id][] = 'forum_posts_unapproved = forum_posts_unapproved + ' . (int) $posts_moved_unapproved;
+ $sync_sql[$forum_id][] = 'forum_posts_unapproved = forum_posts_unapproved - ' . (int) $posts_moved_unapproved;
+ }
+ if ($posts_moved_softdeleted)
{
- $sync_sql[$forum_id][] = 'forum_topics_real = forum_topics_real - ' . (int) $topics_removed;
+ $sync_sql[$to_forum_id][] = 'forum_posts_softdeleted = forum_posts_softdeleted + ' . (int) $posts_moved_softdeleted;
+ $sync_sql[$forum_id][] = 'forum_posts_softdeleted = forum_posts_softdeleted - ' . (int) $posts_moved_softdeleted;
}
- if ($topics_authed_removed)
+ if ($topics_moved)
{
- $sync_sql[$forum_id][] = 'forum_topics = forum_topics - ' . (int) $topics_authed_removed;
+ $sync_sql[$to_forum_id][] = 'forum_topics_approved = forum_topics_approved + ' . (int) $topics_moved;
+ if ($topics_moved - $shadow_topics > 0)
+ {
+ $sync_sql[$forum_id][] = 'forum_topics_approved = forum_topics_approved - ' . (int) ($topics_moved - $shadow_topics);
+ }
+ }
+ if ($topics_moved_unapproved)
+ {
+ $sync_sql[$to_forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved + ' . (int) $topics_moved_unapproved;
+ $sync_sql[$forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved - ' . (int) $topics_moved_unapproved;
+ }
+ if ($topics_moved_softdeleted)
+ {
+ $sync_sql[$to_forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted + ' . (int) $topics_moved_softdeleted;
+ $sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted;
}
$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS';
@@ -636,25 +650,98 @@ function mcp_move_topic($topic_ids)
}
/**
+* Restore Topics
+*/
+function mcp_restore_topic($topic_ids)
+{
+ global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;
+
+ if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve')))
+ {
+ return;
+ }
+
+ $redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
+ $forum_id = $request->variable('f', 0);
+
+ $s_hidden_fields = build_hidden_fields(array(
+ 'topic_id_list' => $topic_ids,
+ 'f' => $forum_id,
+ 'action' => 'restore_topic',
+ 'redirect' => $redirect,
+ ));
+ $success_msg = '';
+
+ if (confirm_box(true))
+ {
+ $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS';
+
+ $data = get_topic_data($topic_ids);
+
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+ foreach ($data as $topic_id => $row)
+ {
+ $return = $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), '');
+ if (!empty($return))
+ {
+ add_log('mod', $row['forum_id'], $topic_id, 'LOG_RESTORE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);
+ }
+ }
+ }
+ else
+ {
+ confirm_box(false, (sizeof($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields);
+ }
+
+ $topic_id = $request->variable('t', 0);
+ if (!$request->is_set('quickmod', phpbb_request_interface::REQUEST))
+ {
+ $redirect = $request->variable('redirect', "index.$phpEx");
+ $redirect = reapply_sid($redirect);
+ $redirect_message = 'PAGE';
+ }
+ else if ($topic_id)
+ {
+ $redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id);
+ $redirect_message = 'TOPIC';
+ }
+ else
+ {
+ $redirect = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
+ $redirect_message = 'FORUM';
+ }
+
+ if (!$success_msg)
+ {
+ redirect($redirect);
+ }
+ else
+ {
+ meta_refresh(3, $redirect);
+ trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_' . $redirect_message], '<a href="' . $redirect . '">', '</a>'));
+ }
+}
+
+/**
* Delete Topics
*/
-function mcp_delete_topic($topic_ids)
+function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic')
{
- global $auth, $user, $db, $phpEx, $phpbb_root_path;
+ global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;
if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete')))
{
return;
}
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
- $forum_id = request_var('f', 0);
+ $redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
+ $forum_id = $request->variable('f', 0);
- $s_hidden_fields = build_hidden_fields(array(
+ $s_hidden_fields = array(
'topic_id_list' => $topic_ids,
'f' => $forum_id,
- 'action' => 'delete_topic',
- 'redirect' => $redirect)
+ 'action' => $action,
+ 'redirect' => $redirect,
);
$success_msg = '';
@@ -672,23 +759,81 @@ function mcp_delete_topic($topic_ids)
}
else
{
- add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);
+ // Only soft delete non-shadow topics
+ if ($is_soft)
+ {
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+ $return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason);
+ if (!empty($return))
+ {
+ add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);
+ }
+ }
+ else
+ {
+ add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);
+ }
}
}
- $return = delete_topics('topic_id', $topic_ids);
+ if (!$is_soft)
+ {
+ $return = delete_topics('topic_id', $topic_ids);
+ }
}
else
{
- confirm_box(false, (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS', $s_hidden_fields);
+ global $template;
+
+ $user->add_lang('posting');
+
+ $only_softdeleted = false;
+ if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id))
+ {
+ // If there are only soft deleted topics, we display a message why the option is not available
+ $sql = 'SELECT topic_id
+ FROM ' . TOPICS_TABLE . '
+ WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
+ AND topic_visibility <> ' . ITEM_DELETED;
+ $result = $db->sql_query_limit($sql, 1);
+ $only_softdeleted = !$db->sql_fetchfield('topic_id');
+ $db->sql_freeresult($result);
+ }
+
+ $template->assign_vars(array(
+ 'S_SOFTDELETED' => $only_softdeleted,
+ 'S_TOPIC_MODE' => true,
+ 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
+ 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
+ 'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id),
+ ));
+
+ $l_confirm = (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS';
+ if ($only_softdeleted)
+ {
+ $l_confirm .= '_PERMANENTLY';
+ $s_hidden_fields['delete_permanent'] = '1';
+ }
+ else if (!$auth->acl_get('m_softdelete', $forum_id))
+ {
+ $s_hidden_fields['delete_permanent'] = '1';
+ }
+
+ confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html');
}
- if (!isset($_REQUEST['quickmod']))
+ $topic_id = $request->variable('t', 0);
+ if (!$request->is_set('quickmod', phpbb_request_interface::REQUEST))
{
- $redirect = request_var('redirect', "index.$phpEx");
+ $redirect = $request->variable('redirect', "index.$phpEx");
$redirect = reapply_sid($redirect);
$redirect_message = 'PAGE';
}
+ else if ($is_soft && $topic_id)
+ {
+ $redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id);
+ $redirect_message = 'TOPIC';
+ }
else
{
$redirect = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
@@ -709,27 +854,93 @@ function mcp_delete_topic($topic_ids)
/**
* Delete Posts
*/
-function mcp_delete_post($post_ids)
+function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post')
{
- global $auth, $user, $db, $phpEx, $phpbb_root_path;
+ global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;
- if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_delete')))
+ if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_softdelete')))
{
return;
}
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
- $forum_id = request_var('f', 0);
+ $redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
+ $forum_id = $request->variable('f', 0);
- $s_hidden_fields = build_hidden_fields(array(
+ $s_hidden_fields = array(
'post_id_list' => $post_ids,
'f' => $forum_id,
- 'action' => 'delete_post',
- 'redirect' => $redirect)
+ 'action' => $action,
+ 'redirect' => $redirect,
);
$success_msg = '';
- if (confirm_box(true))
+ if (confirm_box(true) && $is_soft)
+ {
+ $post_info = get_post_data($post_ids);
+
+ $topic_info = $approve_log = array();
+
+ // Group the posts by topic_id
+ foreach ($post_info as $post_id => $post_data)
+ {
+ if ($post_data['post_visibility'] != ITEM_APPROVED)
+ {
+ continue;
+ }
+ $topic_id = (int) $post_data['topic_id'];
+
+ $topic_info[$topic_id]['posts'][] = (int) $post_id;
+ $topic_info[$topic_id]['forum_id'] = (int) $post_data['forum_id'];
+
+ if ($post_id == $post_data['topic_first_post_id'])
+ {
+ $topic_info[$topic_id]['first_post'] = true;
+ }
+
+ if ($post_id == $post_data['topic_last_post_id'])
+ {
+ $topic_info[$topic_id]['last_post'] = true;
+ }
+
+ $approve_log[] = array(
+ 'forum_id' => $post_data['forum_id'],
+ 'topic_id' => $post_data['topic_id'],
+ 'post_subject' => $post_data['post_subject'],
+ 'poster_id' => $post_data['poster_id'],
+ 'post_username' => $post_data['post_username'],
+ 'username' => $post_data['username'],
+ );
+ }
+
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+ foreach ($topic_info as $topic_id => $topic_data)
+ {
+ $phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post']));
+ }
+ $affected_topics = sizeof($topic_info);
+ // None of the topics is really deleted, so a redirect won't hurt much.
+ $deleted_topics = 0;
+
+ $success_msg = (sizeof($post_info) == 1) ? 'POST_DELETED_SUCCESS' : 'POSTS_DELETED_SUCCESS';
+
+ foreach ($approve_log as $row)
+ {
+ $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username'];
+ add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_SOFTDELETE_POST', $row['post_subject'], $post_username);
+ }
+
+ $topic_id = $request->variable('t', 0);
+
+ // Return links
+ $return_link = array();
+ if ($affected_topics == 1 && $topic_id)
+ {
+ $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id") . '">', '</a>');
+ }
+ $return_link[] = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>');
+
+ }
+ else if (confirm_box(true))
{
if (!function_exists('delete_posts'))
{
@@ -772,7 +983,7 @@ function mcp_delete_post($post_ids)
$deleted_topics = ($row = $db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics;
$db->sql_freeresult($result);
- $topic_id = request_var('t', 0);
+ $topic_id = $request->variable('t', 0);
// Return links
$return_link = array();
@@ -810,10 +1021,45 @@ function mcp_delete_post($post_ids)
}
else
{
- confirm_box(false, (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS', $s_hidden_fields);
+ global $template;
+
+ $user->add_lang('posting');
+
+ $only_softdeleted = false;
+ if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id))
+ {
+ // If there are only soft deleted posts, we display a message why the option is not available
+ $sql = 'SELECT post_id
+ FROM ' . POSTS_TABLE . '
+ WHERE ' . $db->sql_in_set('post_id', $post_ids) . '
+ AND post_visibility <> ' . ITEM_DELETED;
+ $result = $db->sql_query_limit($sql, 1);
+ $only_softdeleted = !$db->sql_fetchfield('post_id');
+ $db->sql_freeresult($result);
+ }
+
+ $template->assign_vars(array(
+ 'S_SOFTDELETED' => $only_softdeleted,
+ 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
+ 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
+ 'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id),
+ ));
+
+ $l_confirm = (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS';
+ if ($only_softdeleted)
+ {
+ $l_confirm .= '_PERMANENTLY';
+ $s_hidden_fields['delete_permanent'] = '1';
+ }
+ else if (!$auth->acl_get('m_softdelete', $forum_id))
+ {
+ $s_hidden_fields['delete_permanent'] = '1';
+ }
+
+ confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html');
}
- $redirect = request_var('redirect', "index.$phpEx");
+ $redirect = $request->variable('redirect', "index.$phpEx");
$redirect = reapply_sid($redirect);
if (!$success_msg)
@@ -898,10 +1144,10 @@ function mcp_fork_topic($topic_ids)
{
$topic_data = get_topic_data($topic_ids, 'f_post');
- $total_posts = 0;
+ $total_topics = $total_topics_unapproved = $total_topics_softdeleted = 0;
+ $total_posts = $total_posts_unapproved = $total_posts_softdeleted = 0;
$new_topic_id_list = array();
-
foreach ($topic_data as $topic_id => $topic_row)
{
if (!isset($search_type) && $topic_row['enable_indexing'])
@@ -932,13 +1178,14 @@ function mcp_fork_topic($topic_ids)
'forum_id' => (int) $to_forum_id,
'icon_id' => (int) $topic_row['icon_id'],
'topic_attachment' => (int) $topic_row['topic_attachment'],
- 'topic_approved' => 1,
+ 'topic_visibility' => (int) $topic_row['topic_visibility'],
'topic_reported' => 0,
'topic_title' => (string) $topic_row['topic_title'],
'topic_poster' => (int) $topic_row['topic_poster'],
'topic_time' => (int) $topic_row['topic_time'],
- 'topic_replies' => (int) $topic_row['topic_replies_real'],
- 'topic_replies_real' => (int) $topic_row['topic_replies_real'],
+ 'topic_posts_approved' => (int) $topic_row['topic_posts_approved'],
+ 'topic_posts_unapproved' => (int) $topic_row['topic_posts_unapproved'],
+ 'topic_posts_softdeleted' => (int) $topic_row['topic_posts_softdeleted'],
'topic_status' => (int) $topic_row['topic_status'],
'topic_type' => (int) $topic_row['topic_type'],
'topic_first_poster_name' => (string) $topic_row['topic_first_poster_name'],
@@ -959,6 +1206,19 @@ function mcp_fork_topic($topic_ids)
$new_topic_id = $db->sql_nextid();
$new_topic_id_list[$topic_id] = $new_topic_id;
+ switch ($topic_row['topic_visibility'])
+ {
+ case ITEM_APPROVED:
+ $total_topics++;
+ break;
+ case ITEM_UNAPPROVED:
+ $total_topics_unapproved++;
+ break;
+ case ITEM_DELETED:
+ $total_topics_softdeleted++;
+ break;
+ }
+
if ($topic_row['poll_start'])
{
$poll_rows = array();
@@ -999,7 +1259,6 @@ function mcp_fork_topic($topic_ids)
continue;
}
- $total_posts += sizeof($post_rows);
foreach ($post_rows as $row)
{
$sql_ary = array(
@@ -1009,7 +1268,7 @@ function mcp_fork_topic($topic_ids)
'icon_id' => (int) $row['icon_id'],
'poster_ip' => (string) $row['poster_ip'],
'post_time' => (int) $row['post_time'],
- 'post_approved' => 1,
+ 'post_visibility' => (int) $row['post_visibility'],
'post_reported' => 0,
'enable_bbcode' => (int) $row['enable_bbcode'],
'enable_smilies' => (int) $row['enable_smilies'],
@@ -1033,6 +1292,19 @@ function mcp_fork_topic($topic_ids)
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_post_id = $db->sql_nextid();
+ switch ($row['post_visibility'])
+ {
+ case ITEM_APPROVED:
+ $total_posts++;
+ break;
+ case ITEM_UNAPPROVED:
+ $total_posts_unapproved++;
+ break;
+ case ITEM_DELETED:
+ $total_posts_softdeleted++;
+ break;
+ }
+
// Copy whether the topic is dotted
markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);
@@ -1125,23 +1397,19 @@ function mcp_fork_topic($topic_ids)
}
// Sync new topics, parent forums and board stats
- sync('topic', 'topic_id', $new_topic_id_list);
-
- $sync_sql = array();
-
- $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . $total_posts;
- $sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . sizeof($new_topic_id_list);
- $sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . sizeof($new_topic_id_list);
-
- foreach ($sync_sql as $forum_id_key => $array)
- {
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . implode(', ', $array) . '
- WHERE forum_id = ' . $forum_id_key;
- $db->sql_query($sql);
- }
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET forum_posts_approved = forum_posts_approved + ' . $total_posts . ',
+ forum_posts_unapproved = forum_posts_unapproved + ' . $total_posts_unapproved . ',
+ forum_posts_softdeleted = forum_posts_softdeleted + ' . $total_posts_softdeleted . ',
+ forum_topics_approved = forum_topics_approved + ' . $total_topics . ',
+ forum_topics_unapproved = forum_topics_unapproved + ' . $total_topics_unapproved . ',
+ forum_topics_softdeleted = forum_topics_softdeleted + ' . $total_topics_softdeleted . '
+ WHERE forum_id = ' . $to_forum_id;
+ $db->sql_query($sql);
+ sync('topic', 'topic_id', $new_topic_id_list);
sync('forum', 'forum_id', $to_forum_id);
+
set_config_count('num_topics', sizeof($new_topic_id_list), true);
set_config_count('num_posts', $total_posts, true);
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index 520c964228..734fa96a78 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -174,6 +174,33 @@ function mcp_post_details($id, $mode, $action)
}
}
+ // Deleting information
+ if ($post_info['post_visibility'] == ITEM_DELETED && $post_info['post_delete_user'])
+ {
+ // User having deleted the post also being the post author?
+ if (!$post_info['post_delete_user'] || $post_info['post_delete_user'] == $post_info['poster_id'])
+ {
+ $display_username = get_username_string('full', $post_info['poster_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']);
+ }
+ else
+ {
+ $sql = 'SELECT user_id, username, user_colour
+ FROM ' . USERS_TABLE . '
+ WHERE user_id = ' . (int) $post_info['post_delete_user'];
+ $result = $db->sql_query($sql);
+ $user_delete_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+ $display_username = get_username_string('full', $post_info['post_delete_user'], $user_delete_row['username'], $user_delete_row['user_colour']);
+ }
+
+ $user->add_lang('viewtopic');
+ $l_deleted_by = $user->lang('DELETED_INFORMATION', $display_username, $user->format_date($post_info['post_delete_time'], false, true));
+ }
+ else
+ {
+ $l_deleted_by = '';
+ }
+
$template->assign_vars(array(
'U_MCP_ACTION' => "$url&amp;i=main&amp;quickmod=1&amp;mode=post_details", // Use this for mode paramaters
'U_POST_ACTION' => "$url&amp;i=$id&amp;mode=post_details", // Use this for action parameters
@@ -185,10 +212,13 @@ function mcp_post_details($id, $mode, $action)
'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']),
'S_POST_REPORTED' => ($post_info['post_reported']) ? true : false,
- 'S_POST_UNAPPROVED' => (!$post_info['post_approved']) ? true : false,
+ 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED) ? true : false,
+ 'S_POST_DELETED' => ($post_info['post_visibility'] == ITEM_DELETED) ? true : false,
'S_POST_LOCKED' => ($post_info['post_edit_locked']) ? true : false,
'S_USER_NOTES' => true,
'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
+ 'DELETED_MESSAGE' => $l_deleted_by,
+ 'DELETE_REASON' => $post_info['post_delete_reason'],
'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '',
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=mcp_chgposter&amp;field=username&amp;select_single=true'),
@@ -205,6 +235,7 @@ function mcp_post_details($id, $mode, $action)
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$post_info['forum_id']}&amp;start={$start}") . '">', '</a>'),
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
+ 'DELETED_IMG' => $user->img('icon_topic_deleted', $user->lang['POST_DELETED']),
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),
@@ -415,7 +446,7 @@ function change_poster(&$post_info, $userdata)
}
// Adjust post counts... only if the post is approved (else, it was not added the users post count anyway)
- if ($post_info['post_postcount'] && $post_info['post_approved'])
+ if ($post_info['post_postcount'] && $post_info['post_visibility'] == ITEM_APPROVED)
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = user_posts - 1
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 24afa1f210..8a9390212f 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -25,14 +25,14 @@ class mcp_queue
var $p_master;
var $u_action;
- function mcp_queue(&$p_master)
+ public function mcp_queue(&$p_master)
{
$this->p_master = &$p_master;
}
- function main($id, $mode)
+ public function main($id, $mode)
{
- global $auth, $db, $user, $template, $cache;
+ global $auth, $db, $user, $template, $cache, $request;
global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
@@ -45,25 +45,99 @@ class mcp_queue
switch ($action)
{
case 'approve':
- case 'disapprove':
+ case 'restore':
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
- $post_id_list = request_var('post_id_list', array(0));
+ $post_id_list = $request->variable('post_id_list', array(0));
+ $topic_id_list = $request->variable('topic_id_list', array(0));
- if (!sizeof($post_id_list))
+ if (!empty($post_id_list))
+ {
+ self::approve_posts($action, $post_id_list, 'queue', $mode);
+ }
+ else if (!empty($topic_id_list))
+ {
+ self::approve_topics($action, $topic_id_list, 'queue', $mode);
+ }
+ else
{
trigger_error('NO_POST_SELECTED');
}
+ break;
+
+ case 'delete':
+ $post_id_list = $request->variable('post_id_list', array(0));
+ $topic_id_list = $request->variable('topic_id_list', array(0));
- if ($action == 'approve')
+ if (!empty($post_id_list))
+ {
+ if (!function_exists('mcp_delete_post'))
+ {
+ global $phpbb_root_path, $phpEx;
+ include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
+ }
+ mcp_delete_post($post_id_list, false, '', $action);
+ }
+ else if (!empty($topic_id_list))
{
- approve_post($post_id_list, 'queue', $mode);
+ if (!function_exists('mcp_delete_topic'))
+ {
+ global $phpbb_root_path, $phpEx;
+ include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
+ }
+ mcp_delete_topic($topic_id_list, false, '', $action);
}
else
{
- disapprove_post($post_id_list, 'queue', $mode);
+ trigger_error('NO_POST_SELECTED');
}
+ break;
+ case 'disapprove':
+ $post_id_list = $request->variable('post_id_list', array(0));
+ $topic_id_list = $request->variable('topic_id_list', array(0));
+
+ if (!empty($topic_id_list) && $mode == 'deleted_topics')
+ {
+ if (!function_exists('mcp_delete_topics'))
+ {
+ global $phpbb_root_path, $phpEx;
+ include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
+ }
+ mcp_delete_topic($topic_id_list, false, '', 'disapprove');
+ return;
+ }
+
+ if (!class_exists('messenger'))
+ {
+ include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ }
+
+ if (!empty($topic_id_list))
+ {
+ $post_visibility = ($mode == 'deleted_topics') ? ITEM_DELETED : ITEM_UNAPPROVED;
+ $sql = 'SELECT post_id
+ FROM ' . POSTS_TABLE . '
+ WHERE post_visibility = ' . $post_visibility . '
+ AND ' . $db->sql_in_set('topic_id', $topic_id_list);
+ $result = $db->sql_query($sql);
+
+ $post_id_list = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $post_id_list[] = (int) $row['post_id'];
+ }
+ $db->sql_freeresult($result);
+ }
+
+ if (!empty($post_id_list))
+ {
+ self::disapprove_posts($post_id_list, 'queue', $mode);
+ }
+ else
+ {
+ trigger_error('NO_POST_SELECTED');
+ }
break;
}
@@ -111,8 +185,8 @@ class mcp_queue
$template->assign_vars(array(
'S_TOPIC_REVIEW' => true,
'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'],
- 'TOPIC_TITLE' => $post_info['topic_title'])
- );
+ 'TOPIC_TITLE' => $post_info['topic_title'],
+ ));
}
$extensions = $attachments = $topic_tracking_info = array();
@@ -175,12 +249,39 @@ class mcp_queue
foreach ($attachments as $attachment)
{
$template->assign_block_vars('attachment', array(
- 'DISPLAY_ATTACHMENT' => $attachment)
- );
+ 'DISPLAY_ATTACHMENT' => $attachment,
+ ));
}
}
}
+ // Deleting information
+ if ($post_info['post_visibility'] == ITEM_DELETED && $post_info['post_delete_user'])
+ {
+ // User having deleted the post also being the post author?
+ if (!$post_info['post_delete_user'] || $post_info['post_delete_user'] == $post_info['poster_id'])
+ {
+ $display_username = get_username_string('full', $post_info['poster_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']);
+ }
+ else
+ {
+ $sql = 'SELECT u.user_id, u.username, u.user_colour
+ FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
+ WHERE p.post_id = ' . $post_info['post_id'] . '
+ AND p.post_delete_user = u.user_id';
+ $result = $db->sql_query($sql);
+ $post_delete_userinfo = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+ $display_username = get_username_string('full', $post_info['post_delete_user'], $post_delete_userinfo['username'], $post_delete_userinfo['user_colour']);
+ }
+
+ $l_deleted_by = $user->lang('DELETED_INFORMATION', $display_username, $user->format_date($post_info['post_delete_time'], false, true));
+ }
+ else
+ {
+ $l_deleted_by = '';
+ }
+
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']);
@@ -189,9 +290,12 @@ class mcp_queue
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&amp;p=$post_id&amp;f=$forum_id"),
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
'S_POST_REPORTED' => $post_info['post_reported'],
- 'S_POST_UNAPPROVED' => !$post_info['post_approved'],
+ 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED),
'S_POST_LOCKED' => $post_info['post_edit_locked'],
'S_USER_NOTES' => true,
+ 'S_POST_DELETED' => ($post_info['post_visibility'] == ITEM_DELETED),
+ 'DELETED_MESSAGE' => $l_deleted_by,
+ 'DELETE_REASON' => $post_info['post_delete_reason'],
'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '',
'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
@@ -203,7 +307,8 @@ class mcp_queue
'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'),
- 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue' . (($topic_id) ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . "&amp;start=$start\">", '</a>'),
+
+ 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue' . (($topic_id) ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . '&amp;start=' . $start . '">', '</a>'),
'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'),
'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'),
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
@@ -230,9 +335,16 @@ class mcp_queue
case 'unapproved_topics':
case 'unapproved_posts':
+ case 'deleted_topics':
+ case 'deleted_posts':
+ $m_perm = 'm_approve';
+ $is_topics = ($mode == 'unapproved_topics' || $mode == 'deleted_topics') ? true : false;
+ $is_restore = ($mode == 'deleted_posts' || $mode == 'deleted_topics') ? true : false;
+ $visibility_const = (!$is_restore) ? ITEM_UNAPPROVED : ITEM_DELETED;
+
$user->add_lang(array('viewtopic', 'viewforum'));
- $topic_id = request_var('t', 0);
+ $topic_id = $request->variable('t', 0);
$forum_info = array();
if ($topic_id)
@@ -248,7 +360,7 @@ class mcp_queue
$forum_id = $topic_info['forum_id'];
}
- $forum_list_approve = get_forum_list('m_approve', false, true);
+ $forum_list_approve = get_forum_list($m_perm, false, true);
$forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs
// Remove forums we cannot read
@@ -274,16 +386,16 @@ class mcp_queue
trigger_error('NOT_MODERATOR');
}
- $sql = 'SELECT SUM(forum_topics) as sum_forum_topics
+ $sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
$result = $db->sql_query($sql);
- $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
+ $forum_info['forum_topics_approved'] = (int) $db->sql_fetchfield('sum_forum_topics');
$db->sql_freeresult($result);
}
else
{
- $forum_info = get_forum_data(array($forum_id), 'm_approve');
+ $forum_info = get_forum_data(array($forum_id), $m_perm);
if (!sizeof($forum_info))
{
@@ -305,21 +417,22 @@ class mcp_queue
$sort_by_sql = $sort_order_sql = array();
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
- $forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
+ $forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total;
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
$forum_names = array();
- if ($mode == 'unapproved_posts')
+ if (!$is_topics)
{
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . '
WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . '
- AND p.post_approved = 0
+ AND p.post_visibility = ' . $visibility_const . '
' . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
AND t.topic_id = p.topic_id
- AND t.topic_first_post_id <> p.post_id
+ AND (t.topic_visibility <> p.post_visibility
+ OR t.topic_delete_user = 0)
$limit_time_sql
ORDER BY $sort_order_sql";
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
@@ -365,9 +478,10 @@ class mcp_queue
else
{
$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_attachment AS post_attachment, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour
- FROM ' . TOPICS_TABLE . " t
- WHERE " . $db->sql_in_set('forum_id', $forum_list) . "
- AND topic_approved = 0
+ FROM ' . TOPICS_TABLE . ' t
+ WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
+ AND topic_visibility = ' . $visibility_const . "
+ AND topic_delete_user <> 0
$limit_time_sql
ORDER BY $sort_order_sql";
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
@@ -401,7 +515,7 @@ class mcp_queue
{
if (empty($row['post_username']))
{
- $row['post_username'] = $user->lang['GUEST'];
+ $row['post_username'] = $row['username'] ?: $user->lang['GUEST'];
}
$template->assign_block_vars('postrow', array(
@@ -416,6 +530,7 @@ class mcp_queue
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_ID' => $row['post_id'],
+ 'TOPIC_ID' => $row['topic_id'],
'FORUM_NAME' => $forum_names[$row['forum_id']],
'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
'TOPIC_TITLE' => $row['topic_title'],
@@ -430,581 +545,693 @@ class mcp_queue
// Now display the page
$template->assign_vars(array(
- 'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'],
- 'L_EXPLAIN' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'],
- 'L_TITLE' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'],
+ 'L_DISPLAY_ITEMS' => (!$is_topics) ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'],
+ 'L_EXPLAIN' => $user->lang['MCP_QUEUE_' . strtoupper($mode) . '_EXPLAIN'],
+ 'L_TITLE' => $user->lang['MCP_QUEUE_' . strtoupper($mode)],
'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',
'S_FORUM_OPTIONS' => $forum_options,
'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
- 'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true,
+ 'S_TOPICS' => $is_topics,
+ 'S_RESTORE' => $is_restore,
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
- 'TOTAL' => $user->lang((($mode == 'unapproved_posts') ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total),
+ 'TOTAL' => $user->lang(((!$is_topics) ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total),
));
$this->tpl_name = 'mcp_queue';
break;
}
}
-}
-
-/**
-* Approve Post/Topic
-*/
-function approve_post($post_id_list, $id, $mode)
-{
- global $db, $template, $user, $config;
- global $phpEx, $phpbb_root_path;
- global $request, $phpbb_container;
- if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
+ /**
+ * Approve/Restore posts
+ *
+ * @param $action string Action we perform on the posts ('approve' or 'restore')
+ * @param $post_id_list array IDs of the posts to approve/restore
+ * @param $id mixed Category of the current active module
+ * @param $mode string Active module
+ * @return null
+ */
+ static public function approve_posts($action, $post_id_list, $id, $mode)
{
- trigger_error('NOT_AUTHORISED');
- }
+ global $db, $template, $user, $config, $request, $phpbb_container;
+ global $phpEx, $phpbb_root_path;
- $redirect = request_var('redirect', build_url(array('quickmod')));
- $success_msg = '';
+ if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
+ {
+ trigger_error('NOT_AUTHORISED');
+ }
- $s_hidden_fields = build_hidden_fields(array(
- 'i' => $id,
- 'mode' => $mode,
- 'post_id_list' => $post_id_list,
- 'action' => 'approve',
- 'redirect' => $redirect)
- );
+ $redirect = $request->variable('redirect', build_url(array('quickmod')));
+ $success_msg = $post_url = '';
+ $approve_log = array();
- $post_info = get_post_data($post_id_list, 'm_approve');
+ $s_hidden_fields = build_hidden_fields(array(
+ 'i' => $id,
+ 'mode' => $mode,
+ 'post_id_list' => $post_id_list,
+ 'action' => $action,
+ 'redirect' => $redirect,
+ ));
- if (confirm_box(true))
- {
- $notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
+ $post_info = get_post_data($post_id_list, 'm_approve');
- // If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1
- // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1
+ if (confirm_box(true))
+ {
+ $notify_poster = ($action == 'approve' && isset($_REQUEST['notify_poster']));
- $total_topics = $total_posts = 0;
- $topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
- $user_posts_sql = $post_approved_list = array();
+ $topic_info = array();
- foreach ($post_info as $post_id => $post_data)
- {
- if ($post_data['post_approved'])
+ // Group the posts by topic_id
+ foreach ($post_info as $post_id => $post_data)
{
- $post_approved_list[] = $post_id;
- continue;
- }
+ if ($post_data['post_visibility'] == ITEM_APPROVED)
+ {
+ continue;
+ }
+ $topic_id = (int) $post_data['topic_id'];
- $topic_id_list[$post_data['topic_id']] = 1;
- $forum_id_list[$post_data['forum_id']] = 1;
+ $topic_info[$topic_id]['posts'][] = (int) $post_id;
+ $topic_info[$topic_id]['forum_id'] = (int) $post_data['forum_id'];
- // User post update (we do not care about topic or post, since user posts are strictly connected to posts)
- // But we care about forums where post counts get not increased. ;)
- if ($post_data['post_postcount'])
- {
- $user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1;
- }
+ // Refresh the first post, if the time or id is older then the current one
+ if ($post_id <= $post_data['topic_first_post_id'] || $post_data['post_time'] <= $post_data['topic_time'])
+ {
+ $topic_info[$topic_id]['first_post'] = true;
+ }
- // Topic or Post. ;)
- if ($post_data['topic_first_post_id'] == $post_id)
- {
- $total_topics++;
- $topic_approve_sql[] = $post_data['topic_id'];
+ // Refresh the last post, if the time or id is newer then the current one
+ if ($post_id >= $post_data['topic_last_post_id'] || $post_data['post_time'] >= $post_data['topic_last_post_time'])
+ {
+ $topic_info[$topic_id]['last_post'] = true;
+ }
+
+ $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_data['forum_id']}&amp;t={$post_data['topic_id']}&amp;p={$post_data['post_id']}") . '#p' . $post_data['post_id'];
$approve_log[] = array(
- 'type' => 'topic',
- 'post_subject' => $post_data['post_subject'],
'forum_id' => $post_data['forum_id'],
'topic_id' => $post_data['topic_id'],
+ 'post_subject' => $post_data['post_subject'],
);
}
- else
+
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+ foreach ($topic_info as $topic_id => $topic_data)
{
- $approve_log[] = array(
- 'type' => 'post',
- 'post_subject' => $post_data['post_subject'],
- 'forum_id' => $post_data['forum_id'],
- 'topic_id' => $post_data['topic_id'],
- );
+ $phpbb_content_visibility->set_post_visibility(ITEM_APPROVED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '', isset($topic_data['first_post']), isset($topic_data['last_post']));
}
- $total_posts++;
+ if (sizeof($post_info) >= 1)
+ {
+ $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS';
+ }
- // Increment by topic_replies if we approve a topic...
- // This works because we do not adjust the topic_replies when re-approving a topic after an edit.
- if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies'])
+ foreach ($approve_log as $log_data)
{
- $total_posts += $post_data['topic_replies'];
+ add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_POST_' . strtoupper($action) . 'D', $log_data['post_subject']);
}
- $post_approve_sql[] = $post_id;
- }
+ // Only send out the mails, when the posts are being approved
+ if ($action == 'approve')
+ {
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
- $post_id_list = array_values(array_diff($post_id_list, $post_approved_list));
- for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++)
- {
- unset($post_info[$post_approved_list[$i]]);
- }
+ // Handle notifications
+ foreach ($post_info as $post_id => $post_data)
+ {
+ $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
- if (sizeof($topic_approve_sql))
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . '
- SET topic_approved = 1
- WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql);
- $db->sql_query($sql);
- }
+ $phpbb_notifications->add_notifications(array(
+ 'quote',
+ 'bookmark',
+ 'post',
+ ), $post_data);
+
+ $phpbb_notifications->mark_notifications_read(array(
+ 'quote',
+ 'bookmark',
+ 'post',
+ ), $post_data['post_id'], $user->data['user_id']);
- if (sizeof($post_approve_sql))
+ // Notify Poster?
+ if ($notify_poster)
+ {
+ if ($post_data['poster_id'] == ANONYMOUS)
+ {
+ continue;
+ }
+
+ $phpbb_notifications->add_notifications('approve_post', $post_data);
+ }
+ }
+ }
+ }
+ else
{
- $sql = 'UPDATE ' . POSTS_TABLE . '
- SET post_approved = 1
- WHERE ' . $db->sql_in_set('post_id', $post_approve_sql);
- $db->sql_query($sql);
+ $show_notify = false;
+
+ if ($action == 'approve')
+ {
+ foreach ($post_info as $post_data)
+ {
+ if ($post_data['poster_id'] == ANONYMOUS)
+ {
+ continue;
+ }
+ else
+ {
+ $show_notify = true;
+ break;
+ }
+ }
+ }
+
+ $template->assign_vars(array(
+ 'S_NOTIFY_POSTER' => $show_notify,
+ 'S_' . strtoupper($action) => true,
+ ));
+
+ confirm_box(false, strtoupper($action) . '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
}
- unset($topic_approve_sql, $post_approve_sql);
+ $redirect = $request->variable('redirect', "index.$phpEx");
+ $redirect = reapply_sid($redirect);
- foreach ($approve_log as $log_data)
+ if (!$success_msg)
{
- add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_APPROVED' : 'LOG_POST_APPROVED', $log_data['post_subject']);
+ redirect($redirect);
}
-
- if (sizeof($user_posts_sql))
+ else
{
- // Try to minimize the query count by merging users with the same post count additions
- $user_posts_update = array();
+ meta_refresh(3, $redirect);
- foreach ($user_posts_sql as $user_id => $user_posts)
+ // If approving one post, also give links back to post...
+ $add_message = '';
+ if (sizeof($post_info) == 1 && $post_url)
{
- $user_posts_update[$user_posts][] = $user_id;
+ $add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
}
- foreach ($user_posts_update as $user_posts => $user_id_ary)
+ $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . $add_message;
+
+ if ($request->is_ajax())
{
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_posts = user_posts + ' . $user_posts . '
- WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
- $db->sql_query($sql);
+ $json_response = new phpbb_json_response;
+ $json_response->send(array(
+ 'MESSAGE_TITLE' => $user->lang['INFORMATION'],
+ 'MESSAGE_TEXT' => $message,
+ 'REFRESH_DATA' => null,
+ 'visible' => true,
+ ));
}
- }
- if ($total_topics)
- {
- set_config_count('num_topics', $total_topics, true);
+ trigger_error($message);
}
+ }
+
+ /**
+ * Approve/Restore topics
+ *
+ * @param $action string Action we perform on the posts ('approve' or 'restore')
+ * @param $topic_id_list array IDs of the topics to approve/restore
+ * @param $id mixed Category of the current active module
+ * @param $mode string Active module
+ * @return null
+ */
+ static public function approve_topics($action, $topic_id_list, $id, $mode)
+ {
+ global $db, $template, $user, $config;
+ global $phpEx, $phpbb_root_path, $request, $phpbb_container;
- if ($total_posts)
+ if (!check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve')))
{
- set_config_count('num_posts', $total_posts, true);
+ trigger_error('NOT_AUTHORISED');
}
- sync('topic', 'topic_id', array_keys($topic_id_list), true);
- sync('forum', 'forum_id', array_keys($forum_id_list), true, true);
- unset($topic_id_list, $forum_id_list);
+ $redirect = $request->variable('redirect', build_url(array('quickmod')));
+ $success_msg = $topic_url = '';
+ $approve_log = array();
- // Send out normal user notifications
- $email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
+ $s_hidden_fields = build_hidden_fields(array(
+ 'i' => $id,
+ 'mode' => $mode,
+ 'topic_id_list' => $topic_id_list,
+ 'action' => $action,
+ 'redirect' => $redirect,
+ ));
- $phpbb_notifications = $phpbb_container->get('notification_manager');
+ $topic_info = get_topic_data($topic_id_list, 'm_approve');
- // Handle notifications
- foreach ($post_info as $post_id => $post_data)
+ if (confirm_box(true))
{
- if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id'])
+ $notify_poster = ($action == 'approve' && isset($_REQUEST['notify_poster'])) ? true : false;
+
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+ foreach ($topic_info as $topic_id => $topic_data)
{
- $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']);
+ $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '');
- $phpbb_notifications->add_notifications(array(
- 'quote',
- 'topic',
- ), $post_data);
+ $topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_data['forum_id']}&amp;t={$topic_id}");
- $phpbb_notifications->mark_notifications_read('quote', $post_data['post_id'], $user->data['user_id']);
- $phpbb_notifications->mark_notifications_read('topic', $post_data['topic_id'], $user->data['user_id']);
+ $approve_log[] = array(
+ 'forum_id' => $topic_data['forum_id'],
+ 'topic_id' => $topic_data['topic_id'],
+ 'topic_title' => $topic_data['topic_title'],
+ );
+ }
- if ($notify_poster)
- {
- $phpbb_notifications->add_notifications('approve_topic', $post_data);
- }
+ if (sizeof($topic_info) >= 1)
+ {
+ $success_msg = (sizeof($topic_info) == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS';
}
- else
+
+ foreach ($approve_log as $log_data)
{
- $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
+ add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_TOPIC_' . strtoupper($action) . 'D', $log_data['topic_title']);
+ }
- $phpbb_notifications->add_notifications(array(
- 'quote',
- 'bookmark',
- 'post',
- ), $post_data);
-
- $phpbb_notifications->mark_notifications_read(array(
- 'quote',
- 'bookmark',
- 'post',
- ),$post_data['post_id'], $user->data['user_id']);
+ // Only send out the mails, when the posts are being approved
+ if ($action == 'approve')
+ {
+ // Handle notifications
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
- if ($notify_poster)
+ foreach ($topic_info as $topic_id => $topic_data)
{
- $phpbb_notifications->add_notifications('approve_post', $post_data);
- }
- }
- }
+ $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']);
+ $phpbb_notifications->add_notifications(array(
+ 'quote',
+ 'topic',
+ ), $post_data);
- if (sizeof($post_id_list) == 1)
- {
- $post_data = $post_info[$post_id_list[0]];
- $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_data['forum_id']}&amp;t={$post_data['topic_id']}&amp;p={$post_data['post_id']}") . '#p' . $post_data['post_id'];
- }
- unset($post_info);
+ $phpbb_notifications->mark_notifications_read('quote', $post_data['post_id'], $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('topic', $post_data['topic_id'], $user->data['user_id']);
- if ($total_topics)
- {
- $success_msg = ($total_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
+ if ($notify_poster)
+ {
+ $phpbb_notifications->add_notifications('approve_topic', $post_data);
+ }
+ }
+ }
}
else
{
- $success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
- }
- }
- else
- {
- $show_notify = false;
+ $show_notify = false;
- if ($config['email_enable'] || $config['jab_enable'])
- {
- foreach ($post_info as $post_data)
+ if ($action == 'approve')
{
- if ($post_data['poster_id'] == ANONYMOUS)
- {
- continue;
- }
- else
+ foreach ($topic_info as $topic_data)
{
- $show_notify = true;
- break;
+ if ($topic_data['topic_poster'] == ANONYMOUS)
+ {
+ continue;
+ }
+ else
+ {
+ $show_notify = true;
+ break;
+ }
}
}
- }
- $template->assign_vars(array(
- 'S_NOTIFY_POSTER' => $show_notify,
- 'S_APPROVE' => true)
- );
-
- confirm_box(false, 'APPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
- }
+ $template->assign_vars(array(
+ 'S_NOTIFY_POSTER' => $show_notify,
+ 'S_' . strtoupper($action) => true,
+ ));
- $redirect = request_var('redirect', "index.$phpEx");
- $redirect = reapply_sid($redirect);
+ confirm_box(false, strtoupper($action) . '_TOPIC' . ((sizeof($topic_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
+ }
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- meta_refresh(3, $redirect);
+ $redirect = $request->variable('redirect', "index.$phpEx");
+ $redirect = reapply_sid($redirect);
- // If approving one post, also give links back to post...
- $add_message = '';
- if (sizeof($post_id_list) == 1 && !empty($post_url))
+ if (!$success_msg)
{
- $add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
+ redirect($redirect);
}
+ else
+ {
+ meta_refresh(3, $redirect);
- $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message;
+ // If approving one topic, also give links back to topic...
+ $add_message = '';
+ if (sizeof($topic_info) == 1 && $topic_url)
+ {
+ $add_message = '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $topic_url . '">', '</a>');
+ }
- if ($request->is_ajax())
- {
- $json_response = new phpbb_json_response;
- $json_response->send(array(
- 'MESSAGE_TITLE' => $user->lang['INFORMATION'],
- 'MESSAGE_TEXT' => $message,
- 'REFRESH_DATA' => null,
- 'approved' => true
- ));
- }
+ $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . $add_message;
- trigger_error($message);
- }
-}
+ if ($request->is_ajax())
+ {
+ $json_response = new phpbb_json_response;
+ $json_response->send(array(
+ 'MESSAGE_TITLE' => $user->lang['INFORMATION'],
+ 'MESSAGE_TEXT' => $message,
+ 'REFRESH_DATA' => null,
+ 'visible' => true,
+ ));
+ }
-/**
-* Disapprove Post/Topic
-*/
-function disapprove_post($post_id_list, $id, $mode)
-{
- global $db, $template, $user, $config;
- global $phpEx, $phpbb_root_path;
- global $request, $phpbb_container;
+ trigger_error($message);
+ }
+ }
- if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
+ /**
+ * Disapprove Post
+ *
+ * @param $post_id_list array IDs of the posts to disapprove/delete
+ * @param $id mixed Category of the current active module
+ * @param $mode string Active module
+ * @return null
+ */
+ static public function disapprove_posts($post_id_list, $id, $mode)
{
- trigger_error('NOT_AUTHORISED');
- }
+ global $db, $template, $user, $config, $phpbb_container;
+ global $phpEx, $phpbb_root_path, $request;
- $redirect = request_var('redirect', build_url(array('t', 'mode', 'quickmod')) . "&amp;mode=$mode");
- $reason = utf8_normalize_nfc(request_var('reason', '', true));
- $reason_id = request_var('reason_id', 0);
- $success_msg = $additional_msg = '';
+ if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
+ {
+ trigger_error('NOT_AUTHORISED');
+ }
- $s_hidden_fields = build_hidden_fields(array(
- 'i' => $id,
- 'mode' => $mode,
- 'post_id_list' => $post_id_list,
- 'action' => 'disapprove',
- 'redirect' => $redirect)
- );
+ $redirect = $request->variable('redirect', build_url(array('t', 'mode', 'quickmod')) . "&amp;mode=$mode");
+ $reason = $request->variable('reason', '', true);
+ $reason_id = $request->variable('reason_id', 0);
+ $success_msg = $additional_msg = '';
- $notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
- $disapprove_reason = '';
+ $s_hidden_fields = build_hidden_fields(array(
+ 'i' => $id,
+ 'mode' => $mode,
+ 'post_id_list' => $post_id_list,
+ 'action' => 'disapprove',
+ 'redirect' => $redirect,
+ ));
- if ($reason_id)
- {
- $sql = 'SELECT reason_title, reason_description
- FROM ' . REPORTS_REASONS_TABLE . "
- WHERE reason_id = $reason_id";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if (!$row || (!$reason && strtolower($row['reason_title']) == 'other'))
- {
- $additional_msg = $user->lang['NO_REASON_DISAPPROVAL'];
+ $notify_poster = $request->is_set('notify_poster');
+ $disapprove_reason = '';
- $request->overwrite('confirm', null, phpbb_request_interface::POST);
- $request->overwrite('confirm_key', null, phpbb_request_interface::POST);
- $request->overwrite('confirm_key', null, phpbb_request_interface::REQUEST);
- }
- else
+ if ($reason_id)
{
- // If the reason is defined within the language file, we will use the localized version, else just use the database entry...
- $disapprove_reason = (strtolower($row['reason_title']) != 'other') ? ((isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description']) : '';
- $disapprove_reason .= ($reason) ? "\n\n" . $reason : '';
-
- if (isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
+ $sql = 'SELECT reason_title, reason_description
+ FROM ' . REPORTS_REASONS_TABLE . "
+ WHERE reason_id = $reason_id";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if (!$row || (!$reason && strtolower($row['reason_title']) == 'other'))
{
- $disapprove_reason_lang = strtoupper($row['reason_title']);
+ $additional_msg = $user->lang['NO_REASON_DISAPPROVAL'];
+
+ $request->overwrite('confirm', null, phpbb_request_interface::POST);
+ $request->overwrite('confirm_key', null, phpbb_request_interface::POST);
+ $request->overwrite('confirm_key', null, phpbb_request_interface::REQUEST);
}
+ else
+ {
+ // If the reason is defined within the language file, we will use the localized version, else just use the database entry...
+ $disapprove_reason = (strtolower($row['reason_title']) != 'other') ? ((isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description']) : '';
+ $disapprove_reason .= ($reason) ? "\n\n" . $reason : '';
- $email_disapprove_reason = $disapprove_reason;
+ if (isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
+ {
+ $disapprove_reason_lang = strtoupper($row['reason_title']);
+ }
+ }
}
- }
- $post_info = get_post_data($post_id_list, 'm_approve');
+ $post_info = get_post_data($post_id_list, 'm_approve');
- if (confirm_box(true))
- {
- $disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array();
- $topic_replies_real = $post_disapprove_list = array();
-
- // Build a list of posts to be unapproved and get the related topics real replies count
+ $is_disapproving = false;
foreach ($post_info as $post_id => $post_data)
{
- $post_disapprove_list[$post_id] = $post_data['topic_id'];
- if (!isset($topic_replies_real[$post_data['topic_id']]))
+ if ($post_data['post_visibility'] == ITEM_DELETED)
{
- $topic_replies_real[$post_data['topic_id']] = $post_data['topic_replies_real'];
+ continue;
}
+
+ $is_disapproving = true;
}
- // Now we build the log array
- foreach ($post_disapprove_list as $post_id => $topic_id)
+ if (confirm_box(true))
{
- // If the count of disapproved posts for the topic is greater
- // than topic's real replies count, the whole topic is disapproved/deleted
- if (sizeof(array_keys($post_disapprove_list, $topic_id)) > $topic_replies_real[$topic_id])
+ $disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array();
+ $topic_posts_unapproved = $post_disapprove_list = $topic_information = array();
+
+ // Build a list of posts to be disapproved and get the related topics real replies count
+ foreach ($post_info as $post_id => $post_data)
{
- // Don't write the log more than once for every topic
- if (!isset($disapprove_log_topics[$topic_id]))
+ $post_disapprove_list[$post_id] = $post_data['topic_id'];
+ if (!isset($topic_posts_unapproved[$post_data['topic_id']]))
{
- // Build disapproved topics log
- $disapprove_log_topics[$topic_id] = array(
- 'type' => 'topic',
- 'post_subject' => $post_info[$post_id]['topic_title'],
- 'forum_id' => $post_info[$post_id]['forum_id'],
- 'topic_id' => 0, // useless to log a topic id, as it will be deleted
- );
+ $topic_information[$post_data['topic_id']] = $post_data;
+ $topic_posts_unapproved[$post_data['topic_id']] = 0;
}
+ $topic_posts_unapproved[$post_data['topic_id']]++;
}
- else
+
+ // Now we build the log array
+ foreach ($post_disapprove_list as $post_id => $topic_id)
{
- // Build disapproved posts log
- $disapprove_log_posts[] = array(
- 'type' => 'post',
- 'post_subject' => $post_info[$post_id]['post_subject'],
- 'forum_id' => $post_info[$post_id]['forum_id'],
- 'topic_id' => $post_info[$post_id]['topic_id'],
- );
+ // If the count of disapproved posts for the topic is equal
+ // to the number of unapproved posts in the topic, and there are no different
+ // posts, we disapprove the hole topic
+ if ($topic_information[$topic_id]['topic_posts_approved'] == 0 &&
+ $topic_information[$topic_id]['topic_posts_softdeleted'] == 0 &&
+ $topic_information[$topic_id]['topic_posts_unapproved'] == $topic_posts_unapproved[$topic_id])
+ {
+ // Don't write the log more than once for every topic
+ if (!isset($disapprove_log_topics[$topic_id]))
+ {
+ // Build disapproved topics log
+ $disapprove_log_topics[$topic_id] = array(
+ 'type' => 'topic',
+ 'post_subject' => $post_info[$post_id]['topic_title'],
+ 'forum_id' => $post_info[$post_id]['forum_id'],
+ 'topic_id' => 0, // useless to log a topic id, as it will be deleted
+ 'post_username' => ($post_info[$post_id]['poster_id'] == ANONYMOUS && !empty($post_info[$post_id]['post_username'])) ? $post_info[$post_id]['post_username'] : $post_info[$post_id]['username'],
+ );
+ }
+ }
+ else
+ {
+ // Build disapproved posts log
+ $disapprove_log_posts[] = array(
+ 'type' => 'post',
+ 'post_subject' => $post_info[$post_id]['post_subject'],
+ 'forum_id' => $post_info[$post_id]['forum_id'],
+ 'topic_id' => $post_info[$post_id]['topic_id'],
+ 'post_username' => ($post_info[$post_id]['poster_id'] == ANONYMOUS && !empty($post_info[$post_id]['post_username'])) ? $post_info[$post_id]['post_username'] : $post_info[$post_id]['username'],
+ );
+ }
}
- }
- // Get disapproved posts/topics counts separately
- $num_disapproved_topics = sizeof($disapprove_log_topics);
- $num_disapproved_posts = sizeof($disapprove_log_posts);
+ // Get disapproved posts/topics counts separately
+ $num_disapproved_topics = sizeof($disapprove_log_topics);
+ $num_disapproved_posts = sizeof($disapprove_log_posts);
- // Build the whole log
- $disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts);
+ // Build the whole log
+ $disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts);
- // Unset unneeded arrays
- unset($post_data, $disapprove_log_topics, $disapprove_log_posts);
+ // Unset unneeded arrays
+ unset($post_data, $disapprove_log_topics, $disapprove_log_posts);
- // Let's do the job - delete disapproved posts
- if (sizeof($post_disapprove_list))
- {
- if (!function_exists('delete_posts'))
+ // Let's do the job - delete disapproved posts
+ if (sizeof($post_disapprove_list))
{
- include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
- }
+ if (!function_exists('delete_posts'))
+ {
+ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
+ }
- // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts
- // Note: function delete_posts triggers related forums/topics sync,
- // so we don't need to call update_post_information later and to adjust real topic replies or forum topics count manually
- delete_posts('post_id', array_keys($post_disapprove_list));
+ // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts
+ // Note: function delete_posts triggers related forums/topics sync,
+ // so we don't need to call update_post_information later and to adjust real topic replies or forum topics count manually
+ delete_posts('post_id', array_keys($post_disapprove_list));
- foreach ($disapprove_log as $log_data)
- {
- add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED', $log_data['post_subject'], $disapprove_reason);
+ foreach ($disapprove_log as $log_data)
+ {
+ if ($is_disapproving)
+ {
+ $l_log_message = ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED';
+ add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $disapprove_reason);
+ }
+ else
+ {
+ $l_log_message = ($log_data['type'] == 'topic') ? 'LOG_DELETE_TOPIC' : 'LOG_DELETE_POST';
+ add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $log_data['post_username']);
+ }
+ }
}
- }
- $phpbb_notifications = $phpbb_container->get('notification_manager');
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
- foreach ($post_info as $post_id => $post_data)
- {
- if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id'])
- {
- $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']);
- }
- else
- {
- $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
- }
- }
-
- // Notify Poster?
- if ($notify_poster)
- {
$lang_reasons = array();
- // Handle notifications
foreach ($post_info as $post_id => $post_data)
{
- $post_data['disapprove_reason'] = '';
- if (isset($disapprove_reason_lang))
+ $disapprove_all_posts_in_topic = $topic_information[$topic_id]['topic_posts_approved'] == 0 &&
+ $topic_information[$topic_id]['topic_posts_softdeleted'] == 0 &&
+ $topic_information[$topic_id]['topic_posts_unapproved'] == $topic_posts_unapproved[$topic_id];
+
+ $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
+
+ // Do we disapprove the whole topic? Remove potential notifications
+ if ($disapprove_all_posts_in_topic)
{
- // Okay we need to get the reason from the posters language
- if (!isset($lang_reasons[$post_data['user_lang']]))
+ $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']);
+ }
+
+ // Notify Poster?
+ if ($notify_poster)
+ {
+ if ($post_data['poster_id'] == ANONYMOUS)
{
- // Assign the current users translation as the default, this is not ideal but getting the board default adds another layer of complexity.
- $lang_reasons[$post_data['user_lang']] = $user->lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
+ continue;
+ }
- // Only load up the language pack if the language is different to the current one
- if ($post_data['user_lang'] != $user->lang_name && file_exists($phpbb_root_path . '/language/' . $post_data['user_lang'] . '/mcp.' . $phpEx))
+ $post_data['disapprove_reason'] = '';
+ if (isset($disapprove_reason_lang))
+ {
+ // Okay we need to get the reason from the posters language
+ if (!isset($lang_reasons[$post_data['user_lang']]))
{
- // Load up the language pack
- $lang = array();
- @include($phpbb_root_path . '/language/' . basename($post_data['user_lang']) . '/mcp.' . $phpEx);
+ // Assign the current users translation as the default, this is not ideal but getting the board default adds another layer of complexity.
+ $lang_reasons[$post_data['user_lang']] = $user->lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
- // If we find the reason in this language pack use it
- if (isset($lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang]))
+ // Only load up the language pack if the language is different to the current one
+ if ($post_data['user_lang'] != $user->lang_name && file_exists($phpbb_root_path . '/language/' . $post_data['user_lang'] . '/mcp.' . $phpEx))
{
- $lang_reasons[$post_data['user_lang']] = $lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
- }
+ // Load up the language pack
+ $lang = array();
+ @include($phpbb_root_path . '/language/' . basename($post_data['user_lang']) . '/mcp.' . $phpEx);
+
+ // If we find the reason in this language pack use it
+ if (isset($lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang]))
+ {
+ $lang_reasons[$post_data['user_lang']] = $lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
+ }
- unset($lang); // Free memory
+ unset($lang); // Free memory
+ }
}
+
+ $post_data['disapprove_reason'] = $lang_reasons[$post_data['user_lang']];
+ $post_data['disapprove_reason'] .= ($reason) ? "\n\n" . $reason : '';
}
- $post_data['disapprove_reason'] = $lang_reasons[$post_data['user_lang']];
- $post_data['disapprove_reason'] .= ($reason) ? "\n\n" . $reason : '';
- }
- if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id'])
- {
- if ($notify_poster)
+ if ($disapprove_all_posts_in_topic && $topic_information[$topic_id]['topic_posts_unapproved'] == 1)
{
+ // If there is only 1 post when disapproving the topic,
+ // we send the user a "disapprove topic" notification...
$phpbb_notifications->add_notifications('disapprove_topic', $post_data);
}
- }
- else
- {
- if ($notify_poster)
+ else
{
+ // ... otherwise there are multiple unapproved posts and
+ // all of them are disapproved as posts.
$phpbb_notifications->add_notifications('disapprove_post', $post_data);
}
}
}
- unset($lang_reasons);
- }
- unset($post_info, $disapprove_reason, $email_disapprove_reason, $disapprove_reason_lang);
+ unset($lang_reasons, $post_info, $disapprove_reason, $disapprove_reason_lang);
- if ($num_disapproved_topics)
- {
- $success_msg = ($num_disapproved_topics == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
+
+ if ($num_disapproved_topics)
+ {
+ $success_msg = ($num_disapproved_topics == 1) ? 'TOPIC' : 'TOPICS';
+ }
+ else
+ {
+ $success_msg = ($num_disapproved_posts == 1) ? 'POST' : 'POSTS';
+ }
+
+ if ($is_disapproving)
+ {
+ $success_msg .= '_DISAPPROVED_SUCCESS';
+ }
+ else
+ {
+ $success_msg .= '_DELETED_SUCCESS';
+ }
}
else
{
- $success_msg = ($num_disapproved_posts == 1) ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS';
- }
- }
- else
- {
- include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+ if (!function_exists('display_reasons'))
+ {
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+ }
- display_reasons($reason_id);
+ $show_notify = false;
- $show_notify = false;
+ foreach ($post_info as $post_data)
+ {
+ if ($post_data['poster_id'] == ANONYMOUS)
+ {
+ continue;
+ }
+ else
+ {
+ $show_notify = true;
+ break;
+ }
+ }
- foreach ($post_info as $post_data)
- {
- if ($post_data['poster_id'] == ANONYMOUS)
+ $l_confirm_msg = 'DISAPPROVE_POST';
+ $confirm_template = 'mcp_approve.html';
+ if ($is_disapproving)
{
- continue;
+ display_reasons($reason_id);
}
else
{
- $show_notify = true;
- break;
+ $user->add_lang('posting');
+
+ $l_confirm_msg = 'DELETE_POST_PERMANENTLY';
+ $confirm_template = 'confirm_delete_body.html';
}
- }
+ $l_confirm_msg .= ((sizeof($post_id_list) == 1) ? '' : 'S');
- $template->assign_vars(array(
- 'S_NOTIFY_POSTER' => $show_notify,
- 'S_APPROVE' => false,
- 'REASON' => $reason,
- 'ADDITIONAL_MSG' => $additional_msg)
- );
+ $template->assign_vars(array(
+ 'S_NOTIFY_POSTER' => $show_notify,
+ 'S_APPROVE' => false,
+ 'REASON' => ($is_disapproving) ? $reason : '',
+ 'ADDITIONAL_MSG' => $additional_msg,
+ ));
- confirm_box(false, 'DISAPPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
- }
+ confirm_box(false, $l_confirm_msg, $s_hidden_fields, $confirm_template);
+ }
- $redirect = request_var('redirect', "index.$phpEx");
- $redirect = reapply_sid($redirect);
+ $redirect = $request->variable('redirect', "index.$phpEx");
+ $redirect = reapply_sid($redirect);
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>');
-
- if ($request->is_ajax())
+ if (!$success_msg)
{
- $json_response = new phpbb_json_response;
- $json_response->send(array(
- 'MESSAGE_TITLE' => $user->lang['INFORMATION'],
- 'MESSAGE_TEXT' => $message,
- 'REFRESH_DATA' => null,
- 'approved' => false
- ));
+ redirect($redirect);
}
+ else
+ {
+ $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>');
- meta_refresh(3, $redirect);
- trigger_error($message);
+ if ($request->is_ajax())
+ {
+ $json_response = new phpbb_json_response;
+ $json_response->send(array(
+ 'MESSAGE_TITLE' => $user->lang['INFORMATION'],
+ 'MESSAGE_TEXT' => $message,
+ 'REFRESH_DATA' => null,
+ 'visible' => false,
+ ));
+ }
+
+ meta_refresh(3, $redirect);
+ trigger_error($message);
+ }
}
}
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 0a600d7057..72400ce623 100644
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -187,7 +187,7 @@ class mcp_reports
'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
'S_POST_REPORTED' => $post_info['post_reported'],
- 'S_POST_UNAPPROVED' => !$post_info['post_approved'],
+ 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == POST_UNAPPROVED),
'S_POST_LOCKED' => $post_info['post_edit_locked'],
'S_USER_NOTES' => true,
@@ -292,11 +292,11 @@ class mcp_reports
$global_id = $forum_list[0];
- $sql = 'SELECT SUM(forum_topics) as sum_forum_topics
+ $sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
$result = $db->sql_query($sql);
- $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
+ $forum_info['forum_topics_approved'] = (int) $db->sql_fetchfield('sum_forum_topics');
$db->sql_freeresult($result);
}
else
@@ -328,7 +328,7 @@ class mcp_reports
$sort_by_sql = $sort_order_sql = array();
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
- $forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
+ $forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total;
$limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : '';
if ($mode == 'reports')
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index e3dd5a6b57..d0e4a2e057 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
function mcp_topic_view($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth, $cache;
+ global $template, $db, $user, $auth, $cache, $phpbb_container;
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url());
@@ -84,8 +84,8 @@ function mcp_topic_view($id, $mode, $action)
$subject = $topic_info['topic_title'];
}
- // Approve posts?
- if ($action == 'approve' && $auth->acl_get('m_approve', $topic_info['forum_id']))
+ // Restore or pprove posts?
+ if (($action == 'restore' || $action == 'approve') && $auth->acl_get('m_approve', $topic_info['forum_id']))
{
include($phpbb_root_path . 'includes/mcp/mcp_queue.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
@@ -98,7 +98,7 @@ function mcp_topic_view($id, $mode, $action)
if (!$sort)
{
- approve_post($post_id_list, $id, $mode);
+ mcp_queue::approve_posts($action, $post_id_list, $id, $mode);
}
}
@@ -112,17 +112,11 @@ function mcp_topic_view($id, $mode, $action)
mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql);
$limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
if ($total == -1)
{
- if ($auth->acl_get('m_approve', $topic_info['forum_id']))
- {
- $total = $topic_info['topic_replies_real'] + 1;
- }
- else
- {
- $total = $topic_info['topic_replies'] + 1;
- }
+ $total = $phpbb_content_visibility->get_count('topic_posts', $topic_info, $topic_info['forum_id']);
}
$posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page'])));
@@ -145,8 +139,8 @@ function mcp_topic_view($id, $mode, $action)
$sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '
- p.topic_id = ' . $topic_id . ' ' .
- ((!$auth->acl_get('m_approve', $topic_info['forum_id'])) ? ' AND p.post_approved = 1 ' : '') . '
+ p.topic_id = ' . $topic_id . '
+ AND ' . $phpbb_content_visibility->get_visibility_sql('post', $topic_info['forum_id'], 'p.') . '
AND p.poster_id = u.user_id ' .
$limit_time_sql . '
ORDER BY ' . $sort_order_sql;
@@ -182,7 +176,7 @@ function mcp_topic_view($id, $mode, $action)
$topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id);
}
- $has_unapproved_posts = false;
+ $has_unapproved_posts = $has_deleted_posts = false;
// Grab extensions
$extensions = $attachments = array();
@@ -227,11 +221,16 @@ function mcp_topic_view($id, $mode, $action)
parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count);
}
- if (!$row['post_approved'])
+ if ($row['post_visibility'] == ITEM_UNAPPROVED)
{
$has_unapproved_posts = true;
}
+ if ($row['post_visibility'] == ITEM_DELETED)
+ {
+ $has_deleted_posts = true;
+ }
+
$post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
$template->assign_block_vars('postrow', array(
@@ -249,7 +248,8 @@ function mcp_topic_view($id, $mode, $action)
'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'),
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $topic_info['forum_id'])),
- 'S_POST_UNAPPROVED' => (!$row['post_approved'] && $auth->acl_get('m_approve', $topic_info['forum_id'])),
+ 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $topic_info['forum_id'])),
+ 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $topic_info['forum_id'])),
'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
@@ -325,6 +325,7 @@ function mcp_topic_view($id, $mode, $action)
'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'),
+ 'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED_RESTORE'),
'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'),
'S_MCP_ACTION' => "$url&amp;i=$id&amp;mode=$mode&amp;action=$action&amp;start=$start",
@@ -333,6 +334,7 @@ function mcp_topic_view($id, $mode, $action)
'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id'])) ? true : false,
'S_CAN_DELETE' => ($auth->acl_get('m_delete', $topic_info['forum_id'])) ? true : false,
'S_CAN_APPROVE' => ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
+ 'S_CAN_RESTORE' => ($has_deleted_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false,
'S_CAN_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? true : false,
'S_CAN_SYNC' => $auth->acl_get('m_', $topic_info['forum_id']),
@@ -448,7 +450,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
if ($sort_order_sql[0] == 'u')
{
- $sql = 'SELECT p.post_id, p.forum_id, p.post_approved
+ $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
@@ -457,7 +459,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
}
else
{
- $sql = 'SELECT p.post_id, p.forum_id, p.post_approved
+ $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility
FROM ' . POSTS_TABLE . " p
WHERE p.topic_id = $topic_id
$limit_time_sql
@@ -470,7 +472,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
while ($row = $db->sql_fetchrow($result))
{
// If split from selected post (split_beyond), we split the unapproved items too.
- if (!$row['post_approved'] && !$auth->acl_get('m_approve', $row['forum_id']))
+ if ($row['post_visibility'] == ITEM_UNAPPROVED && !$auth->acl_get('m_approve', $row['forum_id']))
{
// continue;
}
@@ -497,10 +499,10 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
$icon_id = request_var('icon', 0);
$sql_ary = array(
- 'forum_id' => $to_forum_id,
- 'topic_title' => $subject,
- 'icon_id' => $icon_id,
- 'topic_approved'=> 1
+ 'forum_id' => $to_forum_id,
+ 'topic_title' => $subject,
+ 'icon_id' => $icon_id,
+ 'topic_visibility' => 1
);
$sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 94fd59433b..615b567134 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -642,7 +642,7 @@ class ucp_main
*/
function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
{
- global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx;
+ global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx, $phpbb_container;
$table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
$start = request_var('start', 0);
@@ -768,6 +768,8 @@ class ucp_main
}
}
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
foreach ($topic_list as $topic_id)
{
$row = &$rowset[$topic_id];
@@ -778,7 +780,7 @@ class ucp_main
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
// Replies
- $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
+ $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id']))
{
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index 7c3286c1d1..f24578da84 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -267,7 +267,7 @@ class ucp_prefs
$limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
- $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
+ $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views');
// Post ordering options
$limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 5f30625980..4532ecb609 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -497,8 +497,9 @@ if (!$get_info)
array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'),
array('topic_time', 'topics.topic_time', ''),
array('topic_views', 'topics.topic_views', ''),
- array('topic_replies', 'topics.topic_replies', ''),
- array('topic_replies_real', 'topics.topic_replies', ''),
+ array('topic_posts_approved', 'topics.topic_replies + 1', ''),
+ array('topic_posts_unapproved', 0, ''),
+ array('topic_posts_softdeleted',0, ''),
array('topic_last_post_id', 'topics.topic_last_post_id', ''),
array('topic_status', 'topics.topic_status', 'is_topic_locked'),
array('topic_moved_id', 0, ''),
@@ -530,8 +531,9 @@ if (!$get_info)
array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'),
array('topic_time', 'topics.topic_time', ''),
array('topic_views', 'topics.topic_views', ''),
- array('topic_replies', 'topics.topic_replies', ''),
- array('topic_replies_real', 'topics.topic_replies', ''),
+ array('topic_posts_approved', 'topics.topic_replies + 1', ''),
+ array('topic_posts_unapproved', 0, ''),
+ array('topic_posts_softdeleted',0, ''),
array('topic_last_post_id', 'topics.topic_last_post_id', ''),
array('topic_status', ITEM_MOVED, ''),
array('topic_moved_id', 'topics.topic_moved_id', ''),
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 0b6daeef47..a698f0ef13 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -243,9 +243,12 @@ function phpbb_insert_forums()
'forum_rules_options' => 7,
'forum_rules_uid' => '',
'forum_topics_per_page' => 0,
- 'forum_posts' => 0,
- 'forum_topics' => 0,
- 'forum_topics_real' => 0,
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
'forum_last_post_id' => 0,
'forum_last_poster_id' => 0,
'forum_last_post_subject' => '',
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index b20ca1e4ea..cd6fb7931b 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -82,7 +82,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
// Include files
-require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
+require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
@@ -95,7 +95,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Setup class loader first
-$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
+$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
// Set up container (must be done here because extensions table may not exist)
@@ -217,7 +217,7 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager');
$finder = $phpbb_extension_manager->get_finder();
$migrations = $finder
- ->core_path('includes/db/migration/data/')
+ ->core_path('phpbb/db/migration/data/')
->get_classes();
$migrator->set_migrations($migrations);
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 84a2a023f8..45e5777e36 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -78,7 +78,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
// Include essential scripts
-require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
+require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
@@ -90,7 +90,7 @@ include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
// Setup class loader first
-$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
+$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 6198efe4c7..8a8c440036 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -1464,7 +1464,6 @@ class install_convert extends module
$end = ($sync_batch + $batch_size - 1);
// Sync all topics in batch mode...
- sync('topic_approved', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, false);
sync('topic', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, true);
$template->assign_block_vars('checks', array(
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 3d7b6f7c88..ea23c318e3 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1435,7 +1435,7 @@ class install_install extends module
$db->sql_return_on_error(true);
include_once($phpbb_root_path . 'includes/constants.' . $phpEx);
- include_once($phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx);
+ include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx);
// We need to fill the config to let internal functions correctly work
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
@@ -1888,7 +1888,7 @@ class install_install extends module
/**
* Populate migrations for the installation
*
- * This "installs" all migrations from (root path)/includes/db/migrations/data.
+ * This "installs" all migrations from (root path)/phpbb/db/migrations/data.
* "installs" means it adds all migrations to the migrations table, but does not
* perform any of the actions in the migrations.
*
@@ -1900,7 +1900,7 @@ class install_install extends module
$finder = $extension_manager->get_finder();
$migrations = $finder
- ->core_path('includes/db/migration/data/')
+ ->core_path('phpbb/db/migration/data/')
->get_classes();
$migrator->populate_migrations($migrations);
}
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index a64b8eeffc..ca68ea387d 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -372,9 +372,12 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page INTEGER DEFAULT 0 NOT NULL,
forum_type INTEGER DEFAULT 0 NOT NULL,
forum_status INTEGER DEFAULT 0 NOT NULL,
- forum_posts INTEGER DEFAULT 0 NOT NULL,
- forum_topics INTEGER DEFAULT 0 NOT NULL,
- forum_topics_real INTEGER DEFAULT 0 NOT NULL,
+ forum_posts_approved INTEGER DEFAULT 0 NOT NULL,
+ forum_posts_unapproved INTEGER DEFAULT 0 NOT NULL,
+ forum_posts_softdeleted INTEGER DEFAULT 0 NOT NULL,
+ forum_topics_approved INTEGER DEFAULT 0 NOT NULL,
+ forum_topics_unapproved INTEGER DEFAULT 0 NOT NULL,
+ forum_topics_softdeleted INTEGER DEFAULT 0 NOT NULL,
forum_last_post_id INTEGER DEFAULT 0 NOT NULL,
forum_last_poster_id INTEGER DEFAULT 0 NOT NULL,
forum_last_post_subject VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
@@ -722,7 +725,7 @@ CREATE TABLE phpbb_posts (
icon_id INTEGER DEFAULT 0 NOT NULL,
poster_ip VARCHAR(40) CHARACTER SET NONE DEFAULT '' NOT NULL,
post_time INTEGER DEFAULT 0 NOT NULL,
- post_approved INTEGER DEFAULT 1 NOT NULL,
+ post_visibility INTEGER DEFAULT 0 NOT NULL,
post_reported INTEGER DEFAULT 0 NOT NULL,
enable_bbcode INTEGER DEFAULT 1 NOT NULL,
enable_smilies INTEGER DEFAULT 1 NOT NULL,
@@ -740,7 +743,10 @@ CREATE TABLE phpbb_posts (
post_edit_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
post_edit_user INTEGER DEFAULT 0 NOT NULL,
post_edit_count INTEGER DEFAULT 0 NOT NULL,
- post_edit_locked INTEGER DEFAULT 0 NOT NULL
+ post_edit_locked INTEGER DEFAULT 0 NOT NULL,
+ post_delete_time INTEGER DEFAULT 0 NOT NULL,
+ post_delete_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
+ post_delete_user INTEGER DEFAULT 0 NOT NULL
);;
ALTER TABLE phpbb_posts ADD PRIMARY KEY (post_id);;
@@ -749,7 +755,7 @@ CREATE INDEX phpbb_posts_forum_id ON phpbb_posts(forum_id);;
CREATE INDEX phpbb_posts_topic_id ON phpbb_posts(topic_id);;
CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts(poster_ip);;
CREATE INDEX phpbb_posts_poster_id ON phpbb_posts(poster_id);;
-CREATE INDEX phpbb_posts_post_approved ON phpbb_posts(post_approved);;
+CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts(post_visibility);;
CREATE INDEX phpbb_posts_post_username ON phpbb_posts(post_username);;
CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts(topic_id, post_time);;
@@ -1215,15 +1221,16 @@ CREATE TABLE phpbb_topics (
forum_id INTEGER DEFAULT 0 NOT NULL,
icon_id INTEGER DEFAULT 0 NOT NULL,
topic_attachment INTEGER DEFAULT 0 NOT NULL,
- topic_approved INTEGER DEFAULT 1 NOT NULL,
+ topic_visibility INTEGER DEFAULT 0 NOT NULL,
topic_reported INTEGER DEFAULT 0 NOT NULL,
topic_title VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
topic_poster INTEGER DEFAULT 0 NOT NULL,
topic_time INTEGER DEFAULT 0 NOT NULL,
topic_time_limit INTEGER DEFAULT 0 NOT NULL,
topic_views INTEGER DEFAULT 0 NOT NULL,
- topic_replies INTEGER DEFAULT 0 NOT NULL,
- topic_replies_real INTEGER DEFAULT 0 NOT NULL,
+ topic_posts_approved INTEGER DEFAULT 0 NOT NULL,
+ topic_posts_unapproved INTEGER DEFAULT 0 NOT NULL,
+ topic_posts_softdeleted INTEGER DEFAULT 0 NOT NULL,
topic_status INTEGER DEFAULT 0 NOT NULL,
topic_type INTEGER DEFAULT 0 NOT NULL,
topic_first_post_id INTEGER DEFAULT 0 NOT NULL,
@@ -1244,7 +1251,10 @@ CREATE TABLE phpbb_topics (
poll_length INTEGER DEFAULT 0 NOT NULL,
poll_max_options INTEGER DEFAULT 1 NOT NULL,
poll_last_vote INTEGER DEFAULT 0 NOT NULL,
- poll_vote_change INTEGER DEFAULT 0 NOT NULL
+ poll_vote_change INTEGER DEFAULT 0 NOT NULL,
+ topic_delete_time INTEGER DEFAULT 0 NOT NULL,
+ topic_delete_reason VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
+ topic_delete_user INTEGER DEFAULT 0 NOT NULL
);;
ALTER TABLE phpbb_topics ADD PRIMARY KEY (topic_id);;
@@ -1252,8 +1262,8 @@ ALTER TABLE phpbb_topics ADD PRIMARY KEY (topic_id);;
CREATE INDEX phpbb_topics_forum_id ON phpbb_topics(forum_id);;
CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics(forum_id, topic_type);;
CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics(topic_last_post_time);;
-CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics(topic_approved);;
-CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics(forum_id, topic_approved, topic_last_post_id);;
+CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics(topic_visibility);;
+CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics(forum_id, topic_visibility, topic_last_post_id);;
CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics(forum_id, topic_last_post_time, topic_moved_id);;
CREATE GENERATOR phpbb_topics_gen;;
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 8465dc4d72..a2a6d2192c 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -459,9 +459,12 @@ CREATE TABLE [phpbb_forums] (
[forum_topics_per_page] [int] DEFAULT (0) NOT NULL ,
[forum_type] [int] DEFAULT (0) NOT NULL ,
[forum_status] [int] DEFAULT (0) NOT NULL ,
- [forum_posts] [int] DEFAULT (0) NOT NULL ,
- [forum_topics] [int] DEFAULT (0) NOT NULL ,
- [forum_topics_real] [int] DEFAULT (0) NOT NULL ,
+ [forum_posts_approved] [int] DEFAULT (0) NOT NULL ,
+ [forum_posts_unapproved] [int] DEFAULT (0) NOT NULL ,
+ [forum_posts_softdeleted] [int] DEFAULT (0) NOT NULL ,
+ [forum_topics_approved] [int] DEFAULT (0) NOT NULL ,
+ [forum_topics_unapproved] [int] DEFAULT (0) NOT NULL ,
+ [forum_topics_softdeleted] [int] DEFAULT (0) NOT NULL ,
[forum_last_post_id] [int] DEFAULT (0) NOT NULL ,
[forum_last_poster_id] [int] DEFAULT (0) NOT NULL ,
[forum_last_post_subject] [varchar] (255) DEFAULT ('') NOT NULL ,
@@ -889,7 +892,7 @@ CREATE TABLE [phpbb_posts] (
[icon_id] [int] DEFAULT (0) NOT NULL ,
[poster_ip] [varchar] (40) DEFAULT ('') NOT NULL ,
[post_time] [int] DEFAULT (0) NOT NULL ,
- [post_approved] [int] DEFAULT (1) NOT NULL ,
+ [post_visibility] [int] DEFAULT (0) NOT NULL ,
[post_reported] [int] DEFAULT (0) NOT NULL ,
[enable_bbcode] [int] DEFAULT (1) NOT NULL ,
[enable_smilies] [int] DEFAULT (1) NOT NULL ,
@@ -907,7 +910,10 @@ CREATE TABLE [phpbb_posts] (
[post_edit_reason] [varchar] (255) DEFAULT ('') NOT NULL ,
[post_edit_user] [int] DEFAULT (0) NOT NULL ,
[post_edit_count] [int] DEFAULT (0) NOT NULL ,
- [post_edit_locked] [int] DEFAULT (0) NOT NULL
+ [post_edit_locked] [int] DEFAULT (0) NOT NULL ,
+ [post_delete_time] [int] DEFAULT (0) NOT NULL ,
+ [post_delete_reason] [varchar] (255) DEFAULT ('') NOT NULL ,
+ [post_delete_user] [int] DEFAULT (0) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
@@ -930,7 +936,7 @@ GO
CREATE INDEX [poster_id] ON [phpbb_posts]([poster_id]) ON [PRIMARY]
GO
-CREATE INDEX [post_approved] ON [phpbb_posts]([post_approved]) ON [PRIMARY]
+CREATE INDEX [post_visibility] ON [phpbb_posts]([post_visibility]) ON [PRIMARY]
GO
CREATE INDEX [post_username] ON [phpbb_posts]([post_username]) ON [PRIMARY]
@@ -1463,15 +1469,16 @@ CREATE TABLE [phpbb_topics] (
[forum_id] [int] DEFAULT (0) NOT NULL ,
[icon_id] [int] DEFAULT (0) NOT NULL ,
[topic_attachment] [int] DEFAULT (0) NOT NULL ,
- [topic_approved] [int] DEFAULT (1) NOT NULL ,
+ [topic_visibility] [int] DEFAULT (0) NOT NULL ,
[topic_reported] [int] DEFAULT (0) NOT NULL ,
[topic_title] [varchar] (255) DEFAULT ('') NOT NULL ,
[topic_poster] [int] DEFAULT (0) NOT NULL ,
[topic_time] [int] DEFAULT (0) NOT NULL ,
[topic_time_limit] [int] DEFAULT (0) NOT NULL ,
[topic_views] [int] DEFAULT (0) NOT NULL ,
- [topic_replies] [int] DEFAULT (0) NOT NULL ,
- [topic_replies_real] [int] DEFAULT (0) NOT NULL ,
+ [topic_posts_approved] [int] DEFAULT (0) NOT NULL ,
+ [topic_posts_unapproved] [int] DEFAULT (0) NOT NULL ,
+ [topic_posts_softdeleted] [int] DEFAULT (0) NOT NULL ,
[topic_status] [int] DEFAULT (0) NOT NULL ,
[topic_type] [int] DEFAULT (0) NOT NULL ,
[topic_first_post_id] [int] DEFAULT (0) NOT NULL ,
@@ -1492,7 +1499,10 @@ CREATE TABLE [phpbb_topics] (
[poll_length] [int] DEFAULT (0) NOT NULL ,
[poll_max_options] [int] DEFAULT (1) NOT NULL ,
[poll_last_vote] [int] DEFAULT (0) NOT NULL ,
- [poll_vote_change] [int] DEFAULT (0) NOT NULL
+ [poll_vote_change] [int] DEFAULT (0) NOT NULL ,
+ [topic_delete_time] [int] DEFAULT (0) NOT NULL ,
+ [topic_delete_reason] [varchar] (255) DEFAULT ('') NOT NULL ,
+ [topic_delete_user] [int] DEFAULT (0) NOT NULL
) ON [PRIMARY]
GO
@@ -1512,10 +1522,10 @@ GO
CREATE INDEX [last_post_time] ON [phpbb_topics]([topic_last_post_time]) ON [PRIMARY]
GO
-CREATE INDEX [topic_approved] ON [phpbb_topics]([topic_approved]) ON [PRIMARY]
+CREATE INDEX [topic_visibility] ON [phpbb_topics]([topic_visibility]) ON [PRIMARY]
GO
-CREATE INDEX [forum_appr_last] ON [phpbb_topics]([forum_id], [topic_approved], [topic_last_post_id]) ON [PRIMARY]
+CREATE INDEX [forum_appr_last] ON [phpbb_topics]([forum_id], [topic_visibility], [topic_last_post_id]) ON [PRIMARY]
GO
CREATE INDEX [fid_time_moved] ON [phpbb_topics]([forum_id], [topic_last_post_time], [topic_moved_id]) ON [PRIMARY]
diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql
index 37e4e66ad7..2c5931bae4 100644
--- a/phpBB/install/schemas/mysql_40_schema.sql
+++ b/phpBB/install/schemas/mysql_40_schema.sql
@@ -257,9 +257,12 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL,
forum_type tinyint(4) DEFAULT '0' NOT NULL,
forum_status tinyint(4) DEFAULT '0' NOT NULL,
- forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_subject blob NOT NULL,
@@ -508,7 +511,7 @@ CREATE TABLE phpbb_posts (
icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
poster_ip varbinary(40) DEFAULT '' NOT NULL,
post_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
- post_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
+ post_visibility tinyint(3) DEFAULT '0' NOT NULL,
post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
@@ -527,12 +530,15 @@ CREATE TABLE phpbb_posts (
post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL,
post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
+ post_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
+ post_delete_reason blob NOT NULL,
+ post_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (post_id),
KEY forum_id (forum_id),
KEY topic_id (topic_id),
KEY poster_ip (poster_ip),
KEY poster_id (poster_id),
- KEY post_approved (post_approved),
+ KEY post_visibility (post_visibility),
KEY post_username (post_username(255)),
KEY tid_post_time (topic_id, post_time)
);
@@ -839,15 +845,16 @@ CREATE TABLE phpbb_topics (
forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
- topic_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
+ topic_visibility tinyint(3) DEFAULT '0' NOT NULL,
topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
topic_title blob NOT NULL,
topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_status tinyint(3) DEFAULT '0' NOT NULL,
topic_type tinyint(3) DEFAULT '0' NOT NULL,
topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
@@ -869,12 +876,15 @@ CREATE TABLE phpbb_topics (
poll_max_options tinyint(4) DEFAULT '1' NOT NULL,
poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL,
poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_delete_reason blob NOT NULL,
+ topic_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (topic_id),
KEY forum_id (forum_id),
KEY forum_id_type (forum_id, topic_type),
KEY last_post_time (topic_last_post_time),
- KEY topic_approved (topic_approved),
- KEY forum_appr_last (forum_id, topic_approved, topic_last_post_id),
+ KEY topic_visibility (topic_visibility),
+ KEY forum_appr_last (forum_id, topic_visibility, topic_last_post_id),
KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id)
);
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
index ff0f315f93..7b7be3c462 100644
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ b/phpBB/install/schemas/mysql_41_schema.sql
@@ -257,9 +257,12 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL,
forum_type tinyint(4) DEFAULT '0' NOT NULL,
forum_status tinyint(4) DEFAULT '0' NOT NULL,
- forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
@@ -508,7 +511,7 @@ CREATE TABLE phpbb_posts (
icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
poster_ip varchar(40) DEFAULT '' NOT NULL,
post_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
- post_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
+ post_visibility tinyint(3) DEFAULT '0' NOT NULL,
post_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
@@ -527,12 +530,15 @@ CREATE TABLE phpbb_posts (
post_edit_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
post_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL,
post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
+ post_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
+ post_delete_reason varchar(255) DEFAULT '' NOT NULL,
+ post_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (post_id),
KEY forum_id (forum_id),
KEY topic_id (topic_id),
KEY poster_ip (poster_ip),
KEY poster_id (poster_id),
- KEY post_approved (post_approved),
+ KEY post_visibility (post_visibility),
KEY post_username (post_username),
KEY tid_post_time (topic_id, post_time)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
@@ -839,15 +845,16 @@ CREATE TABLE phpbb_topics (
forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
icon_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_attachment tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
- topic_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
+ topic_visibility tinyint(3) DEFAULT '0' NOT NULL,
topic_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
topic_title varchar(255) DEFAULT '' NOT NULL COLLATE utf8_unicode_ci,
topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL,
topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- topic_replies mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- topic_replies_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_status tinyint(3) DEFAULT '0' NOT NULL,
topic_type tinyint(3) DEFAULT '0' NOT NULL,
topic_first_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
@@ -869,12 +876,15 @@ CREATE TABLE phpbb_topics (
poll_max_options tinyint(4) DEFAULT '1' NOT NULL,
poll_last_vote int(11) UNSIGNED DEFAULT '0' NOT NULL,
poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_delete_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_delete_reason varchar(255) DEFAULT '' NOT NULL,
+ topic_delete_user mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (topic_id),
KEY forum_id (forum_id),
KEY forum_id_type (forum_id, topic_type),
KEY last_post_time (topic_last_post_time),
- KEY topic_approved (topic_approved),
- KEY forum_appr_last (forum_id, topic_approved, topic_last_post_id),
+ KEY topic_visibility (topic_visibility),
+ KEY forum_appr_last (forum_id, topic_visibility, topic_last_post_id),
KEY fid_time_moved (forum_id, topic_last_post_time, topic_moved_id)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 11f245869d..75c01446d8 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -520,9 +520,12 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page number(4) DEFAULT '0' NOT NULL,
forum_type number(4) DEFAULT '0' NOT NULL,
forum_status number(4) DEFAULT '0' NOT NULL,
- forum_posts number(8) DEFAULT '0' NOT NULL,
- forum_topics number(8) DEFAULT '0' NOT NULL,
- forum_topics_real number(8) DEFAULT '0' NOT NULL,
+ forum_posts_approved number(8) DEFAULT '0' NOT NULL,
+ forum_posts_unapproved number(8) DEFAULT '0' NOT NULL,
+ forum_posts_softdeleted number(8) DEFAULT '0' NOT NULL,
+ forum_topics_approved number(8) DEFAULT '0' NOT NULL,
+ forum_topics_unapproved number(8) DEFAULT '0' NOT NULL,
+ forum_topics_softdeleted number(8) DEFAULT '0' NOT NULL,
forum_last_post_id number(8) DEFAULT '0' NOT NULL,
forum_last_poster_id number(8) DEFAULT '0' NOT NULL,
forum_last_post_subject varchar2(765) DEFAULT '' ,
@@ -977,7 +980,7 @@ CREATE TABLE phpbb_posts (
icon_id number(8) DEFAULT '0' NOT NULL,
poster_ip varchar2(40) DEFAULT '' ,
post_time number(11) DEFAULT '0' NOT NULL,
- post_approved number(1) DEFAULT '1' NOT NULL,
+ post_visibility number(3) DEFAULT '0' NOT NULL,
post_reported number(1) DEFAULT '0' NOT NULL,
enable_bbcode number(1) DEFAULT '1' NOT NULL,
enable_smilies number(1) DEFAULT '1' NOT NULL,
@@ -996,6 +999,9 @@ CREATE TABLE phpbb_posts (
post_edit_user number(8) DEFAULT '0' NOT NULL,
post_edit_count number(4) DEFAULT '0' NOT NULL,
post_edit_locked number(1) DEFAULT '0' NOT NULL,
+ post_delete_time number(11) DEFAULT '0' NOT NULL,
+ post_delete_reason varchar2(765) DEFAULT '' ,
+ post_delete_user number(8) DEFAULT '0' NOT NULL,
CONSTRAINT pk_phpbb_posts PRIMARY KEY (post_id)
)
/
@@ -1008,7 +1014,7 @@ CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip)
/
CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id)
/
-CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved)
+CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts (post_visibility)
/
CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username)
/
@@ -1607,15 +1613,16 @@ CREATE TABLE phpbb_topics (
forum_id number(8) DEFAULT '0' NOT NULL,
icon_id number(8) DEFAULT '0' NOT NULL,
topic_attachment number(1) DEFAULT '0' NOT NULL,
- topic_approved number(1) DEFAULT '1' NOT NULL,
+ topic_visibility number(3) DEFAULT '0' NOT NULL,
topic_reported number(1) DEFAULT '0' NOT NULL,
topic_title varchar2(765) DEFAULT '' ,
topic_poster number(8) DEFAULT '0' NOT NULL,
topic_time number(11) DEFAULT '0' NOT NULL,
topic_time_limit number(11) DEFAULT '0' NOT NULL,
topic_views number(8) DEFAULT '0' NOT NULL,
- topic_replies number(8) DEFAULT '0' NOT NULL,
- topic_replies_real number(8) DEFAULT '0' NOT NULL,
+ topic_posts_approved number(8) DEFAULT '0' NOT NULL,
+ topic_posts_unapproved number(8) DEFAULT '0' NOT NULL,
+ topic_posts_softdeleted number(8) DEFAULT '0' NOT NULL,
topic_status number(3) DEFAULT '0' NOT NULL,
topic_type number(3) DEFAULT '0' NOT NULL,
topic_first_post_id number(8) DEFAULT '0' NOT NULL,
@@ -1637,6 +1644,9 @@ CREATE TABLE phpbb_topics (
poll_max_options number(4) DEFAULT '1' NOT NULL,
poll_last_vote number(11) DEFAULT '0' NOT NULL,
poll_vote_change number(1) DEFAULT '0' NOT NULL,
+ topic_delete_time number(11) DEFAULT '0' NOT NULL,
+ topic_delete_reason varchar2(765) DEFAULT '' ,
+ topic_delete_user number(8) DEFAULT '0' NOT NULL,
CONSTRAINT pk_phpbb_topics PRIMARY KEY (topic_id)
)
/
@@ -1647,9 +1657,9 @@ CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type)
/
CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time)
/
-CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved)
+CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics (topic_visibility)
/
-CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id)
+CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id)
/
CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id)
/
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index fea5700167..c7fbe9a507 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -395,9 +395,12 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page INT2 DEFAULT '0' NOT NULL,
forum_type INT2 DEFAULT '0' NOT NULL,
forum_status INT2 DEFAULT '0' NOT NULL,
- forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0),
- forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0),
- forum_topics_real INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_real >= 0),
+ forum_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_approved >= 0),
+ forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0),
+ forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0),
+ forum_topics_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_approved >= 0),
+ forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0),
+ forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0),
forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0),
forum_last_poster_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_poster_id >= 0),
forum_last_post_subject varchar(255) DEFAULT '' NOT NULL,
@@ -694,7 +697,7 @@ CREATE TABLE phpbb_posts (
icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
poster_ip varchar(40) DEFAULT '' NOT NULL,
post_time INT4 DEFAULT '0' NOT NULL CHECK (post_time >= 0),
- post_approved INT2 DEFAULT '1' NOT NULL CHECK (post_approved >= 0),
+ post_visibility INT2 DEFAULT '0' NOT NULL,
post_reported INT2 DEFAULT '0' NOT NULL CHECK (post_reported >= 0),
enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (enable_bbcode >= 0),
enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (enable_smilies >= 0),
@@ -713,6 +716,9 @@ CREATE TABLE phpbb_posts (
post_edit_user INT4 DEFAULT '0' NOT NULL CHECK (post_edit_user >= 0),
post_edit_count INT2 DEFAULT '0' NOT NULL CHECK (post_edit_count >= 0),
post_edit_locked INT2 DEFAULT '0' NOT NULL CHECK (post_edit_locked >= 0),
+ post_delete_time INT4 DEFAULT '0' NOT NULL CHECK (post_delete_time >= 0),
+ post_delete_reason varchar(255) DEFAULT '' NOT NULL,
+ post_delete_user INT4 DEFAULT '0' NOT NULL CHECK (post_delete_user >= 0),
PRIMARY KEY (post_id)
);
@@ -720,7 +726,7 @@ CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id);
CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id);
CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip);
CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id);
-CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved);
+CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts (post_visibility);
CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username);
CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time);
@@ -1093,15 +1099,16 @@ CREATE TABLE phpbb_topics (
forum_id INT4 DEFAULT '0' NOT NULL CHECK (forum_id >= 0),
icon_id INT4 DEFAULT '0' NOT NULL CHECK (icon_id >= 0),
topic_attachment INT2 DEFAULT '0' NOT NULL CHECK (topic_attachment >= 0),
- topic_approved INT2 DEFAULT '1' NOT NULL CHECK (topic_approved >= 0),
+ topic_visibility INT2 DEFAULT '0' NOT NULL,
topic_reported INT2 DEFAULT '0' NOT NULL CHECK (topic_reported >= 0),
topic_title varchar(255) DEFAULT '' NOT NULL,
topic_poster INT4 DEFAULT '0' NOT NULL CHECK (topic_poster >= 0),
topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0),
topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0),
topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0),
- topic_replies INT4 DEFAULT '0' NOT NULL CHECK (topic_replies >= 0),
- topic_replies_real INT4 DEFAULT '0' NOT NULL CHECK (topic_replies_real >= 0),
+ topic_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_approved >= 0),
+ topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0),
+ topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0),
topic_status INT2 DEFAULT '0' NOT NULL,
topic_type INT2 DEFAULT '0' NOT NULL,
topic_first_post_id INT4 DEFAULT '0' NOT NULL CHECK (topic_first_post_id >= 0),
@@ -1123,14 +1130,17 @@ CREATE TABLE phpbb_topics (
poll_max_options INT2 DEFAULT '1' NOT NULL,
poll_last_vote INT4 DEFAULT '0' NOT NULL CHECK (poll_last_vote >= 0),
poll_vote_change INT2 DEFAULT '0' NOT NULL CHECK (poll_vote_change >= 0),
+ topic_delete_time INT4 DEFAULT '0' NOT NULL CHECK (topic_delete_time >= 0),
+ topic_delete_reason varchar(255) DEFAULT '' NOT NULL,
+ topic_delete_user INT4 DEFAULT '0' NOT NULL CHECK (topic_delete_user >= 0),
PRIMARY KEY (topic_id)
);
CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id);
CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type);
CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time);
-CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved);
-CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id);
+CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics (topic_visibility);
+CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id);
CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id);
/*
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 355981721e..d03fdf9de4 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -39,6 +39,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_pm', '1'
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_smilies', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_topic_notify', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('assets_version', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('attachment_quota', '52428800');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_bbcode_pm', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_flash_pm', '0');
@@ -320,6 +321,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_subscribe', 1);
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_user_lock', 1);
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_vote', 1);
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_votechg', 1);
+INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_softdelete', 1);
# -- Moderator related auth options
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_', 1, 1);
@@ -333,6 +335,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_merg
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_move', 1, 1);
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_report', 1, 1);
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_split', 1, 1);
+INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_softdelete', 1, 1);
# -- Global moderator auth option (not a local option)
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_ban', 0, 1);
@@ -453,9 +456,9 @@ INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order)
INSERT INTO phpbb_styles (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '&copy; phpBB Group', 1, 'prosilver', 'kNg=', 0, '');
# -- Forums
-INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 1, 1, 1, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0, '');
+INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0, '');
-INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents, forum_flags) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 1, 1, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 0, 0, '', 48);
+INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents, forum_flags) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 0, 0, 1, 0, 0, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 0, 0, '', 48);
# -- Users / Anonymous user
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0);
@@ -523,7 +526,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 11, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option NOT IN ('m_ban', 'm_chgposter');
# Simple Moderator (m_)
-INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_edit', 'm_info', 'm_report');
+INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_softdelete', 'm_edit', 'm_info', 'm_report');
# Queue Moderator (m_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 13, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_approve', 'm_edit');
@@ -621,10 +624,10 @@ INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id,
# -- Demo Topic
-INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_subject, topic_last_post_time, topic_last_view_time, poll_title) VALUES ('{L_TOPICS_TOPIC_TITLE}', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, 972086460, '');
+INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_subject, topic_last_post_time, topic_last_view_time, poll_title, topic_visibility) VALUES ('{L_TOPICS_TOPIC_TITLE}', 2, 972086460, 0, 1, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, 972086460, '', 1);
# -- Demo Post
-INSERT INTO phpbb_posts (topic_id, forum_id, poster_id, icon_id, post_time, post_username, poster_ip, post_subject, post_text, post_checksum, bbcode_uid) VALUES (1, 2, 2, 0, 972086460, '', '127.0.0.1', '{L_TOPICS_TOPIC_TITLE}', '{L_DEFAULT_INSTALL_POST}', '5dd683b17f641daf84c040bfefc58ce9', '');
+INSERT INTO phpbb_posts (topic_id, forum_id, poster_id, icon_id, post_time, post_username, poster_ip, post_subject, post_text, post_checksum, bbcode_uid, post_visibility) VALUES (1, 2, 2, 0, 972086460, '', '127.0.0.1', '{L_TOPICS_TOPIC_TITLE}', '{L_DEFAULT_INSTALL_POST}', '5dd683b17f641daf84c040bfefc58ce9', '', 1);
# -- Admin posted to the demo topic
INSERT INTO phpbb_topics_posted (user_id, topic_id, topic_posted) VALUES (2, 1, 1);
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index 02ffb9a857..72b2b276da 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -250,9 +250,12 @@ CREATE TABLE phpbb_forums (
forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0',
forum_type tinyint(4) NOT NULL DEFAULT '0',
forum_status tinyint(4) NOT NULL DEFAULT '0',
- forum_posts INTEGER UNSIGNED NOT NULL DEFAULT '0',
- forum_topics INTEGER UNSIGNED NOT NULL DEFAULT '0',
- forum_topics_real INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ forum_posts_approved INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ forum_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ forum_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ forum_topics_approved INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ forum_topics_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ forum_topics_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_last_poster_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
forum_last_post_subject text(65535) NOT NULL DEFAULT '',
@@ -493,7 +496,7 @@ CREATE TABLE phpbb_posts (
icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
poster_ip varchar(40) NOT NULL DEFAULT '',
post_time INTEGER UNSIGNED NOT NULL DEFAULT '0',
- post_approved INTEGER UNSIGNED NOT NULL DEFAULT '1',
+ post_visibility tinyint(3) NOT NULL DEFAULT '0',
post_reported INTEGER UNSIGNED NOT NULL DEFAULT '0',
enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1',
enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1',
@@ -511,14 +514,17 @@ CREATE TABLE phpbb_posts (
post_edit_reason text(65535) NOT NULL DEFAULT '',
post_edit_user INTEGER UNSIGNED NOT NULL DEFAULT '0',
post_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0',
- post_edit_locked INTEGER UNSIGNED NOT NULL DEFAULT '0'
+ post_edit_locked INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ post_delete_time INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ post_delete_reason text(65535) NOT NULL DEFAULT '',
+ post_delete_user INTEGER UNSIGNED NOT NULL DEFAULT '0'
);
CREATE INDEX phpbb_posts_forum_id ON phpbb_posts (forum_id);
CREATE INDEX phpbb_posts_topic_id ON phpbb_posts (topic_id);
CREATE INDEX phpbb_posts_poster_ip ON phpbb_posts (poster_ip);
CREATE INDEX phpbb_posts_poster_id ON phpbb_posts (poster_id);
-CREATE INDEX phpbb_posts_post_approved ON phpbb_posts (post_approved);
+CREATE INDEX phpbb_posts_post_visibility ON phpbb_posts (post_visibility);
CREATE INDEX phpbb_posts_post_username ON phpbb_posts (post_username);
CREATE INDEX phpbb_posts_tid_post_time ON phpbb_posts (topic_id, post_time);
@@ -811,15 +817,16 @@ CREATE TABLE phpbb_topics (
forum_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
icon_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_attachment INTEGER UNSIGNED NOT NULL DEFAULT '0',
- topic_approved INTEGER UNSIGNED NOT NULL DEFAULT '1',
+ topic_visibility tinyint(3) NOT NULL DEFAULT '0',
topic_reported INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_title text(65535) NOT NULL DEFAULT '',
topic_poster INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0',
- topic_replies INTEGER UNSIGNED NOT NULL DEFAULT '0',
- topic_replies_real INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ topic_posts_approved INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ topic_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ topic_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0',
topic_status tinyint(3) NOT NULL DEFAULT '0',
topic_type tinyint(3) NOT NULL DEFAULT '0',
topic_first_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
@@ -840,14 +847,17 @@ CREATE TABLE phpbb_topics (
poll_length INTEGER UNSIGNED NOT NULL DEFAULT '0',
poll_max_options tinyint(4) NOT NULL DEFAULT '1',
poll_last_vote INTEGER UNSIGNED NOT NULL DEFAULT '0',
- poll_vote_change INTEGER UNSIGNED NOT NULL DEFAULT '0'
+ poll_vote_change INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ topic_delete_time INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ topic_delete_reason text(65535) NOT NULL DEFAULT '',
+ topic_delete_user INTEGER UNSIGNED NOT NULL DEFAULT '0'
);
CREATE INDEX phpbb_topics_forum_id ON phpbb_topics (forum_id);
CREATE INDEX phpbb_topics_forum_id_type ON phpbb_topics (forum_id, topic_type);
CREATE INDEX phpbb_topics_last_post_time ON phpbb_topics (topic_last_post_time);
-CREATE INDEX phpbb_topics_topic_approved ON phpbb_topics (topic_approved);
-CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_approved, topic_last_post_id);
+CREATE INDEX phpbb_topics_topic_visibility ON phpbb_topics (topic_visibility);
+CREATE INDEX phpbb_topics_forum_appr_last ON phpbb_topics (forum_id, topic_visibility, topic_last_post_id);
CREATE INDEX phpbb_topics_fid_time_moved ON phpbb_topics (forum_id, topic_last_post_time, topic_moved_id);
# Table: 'phpbb_topics_track'
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 4c2002754f..9c470efcd9 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -311,7 +311,7 @@ $lang = array_merge($lang, array(
// PHP info
$lang = array_merge($lang, array(
- 'ACP_PHP_INFO_EXPLAIN' => 'This page lists information on the version of PHP installed on this server. It includes details of loaded modules, available variables and default settings. This information may be useful when diagnosing problems. Please be aware that some hosting companies will limit what information is displayed here for security reasons. You are advised to not give out any details on this page except when asked by <a href="http://www.phpbb.com/about/team/">official team members</a> on the support forums.',
+ 'ACP_PHP_INFO_EXPLAIN' => 'This page lists information on the version of PHP installed on this server. It includes details of loaded modules, available variables and default settings. This information may be useful when diagnosing problems. Please be aware that some hosting companies will limit what information is displayed here for security reasons. You are advised to not give out any details on this page except when asked by <a href="https://www.phpbb.com/about/team/">official team members</a> on the support forums.',
'NO_PHPINFO_AVAILABLE' => 'Information about your PHP configuration is unable to be determined. Phpinfo() has been disabled for security reasons.',
));
@@ -559,12 +559,17 @@ $lang = array_merge($lang, array(
'LOG_POST_APPROVED' => '<strong>Approved post</strong><br />» %s',
'LOG_POST_DISAPPROVED' => '<strong>Disapproved post “%1$s” with the following reason</strong><br />» %2$s',
'LOG_POST_EDITED' => '<strong>Edited post “%1$s” written by</strong><br />» %2$s',
+ 'LOG_POST_RESTORED' => '<strong>Restored post</strong><br />» %s',
'LOG_REPORT_CLOSED' => '<strong>Closed report</strong><br />» %s',
'LOG_REPORT_DELETED' => '<strong>Deleted report</strong><br />» %s',
+ 'LOG_RESTORE_TOPIC' => '<strong>Restored topic “%1$s” written by</strong><br />» %2$s',
+ 'LOG_SOFTDELETE_POST' => '<strong>Soft deleted post “%1$s” written by</strong><br />» %2$s',
+ 'LOG_SOFTDELETE_TOPIC' => '<strong>Soft deleted topic “%1$s” written by</strong><br />» %2$s',
'LOG_SPLIT_DESTINATION' => '<strong>Moved split posts</strong><br />» to %s',
'LOG_SPLIT_SOURCE' => '<strong>Split posts</strong><br />» from %s',
'LOG_TOPIC_APPROVED' => '<strong>Approved topic</strong><br />» %s',
+ 'LOG_TOPIC_RESTORED' => '<strong>Restored topic</strong><br />» %s',
'LOG_TOPIC_DISAPPROVED' => '<strong>Disapproved topic “%1$s” with the following reason</strong><br />%2$s',
'LOG_TOPIC_RESYNC' => '<strong>Resynchronised topic counters</strong><br />» %s',
'LOG_TOPIC_TYPE_CHANGED' => '<strong>Changed topic type</strong><br />» %s',
diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php
index cf5ad33bab..709836e828 100644
--- a/phpBB/language/en/acp/permissions.php
+++ b/phpBB/language/en/acp/permissions.php
@@ -52,7 +52,7 @@ $lang = array_merge($lang, array(
<br />
- <p>For further information on setting up and managing permissions on your phpBB3 board, please see <a href="http://www.phpbb.com/support/documentation/3.0/quickstart/quick_permissions.html">Chapter 1.5 of our Quick Start Guide</a>.</p>
+ <p>For further information on setting up and managing permissions on your phpBB3 board, please see <a href="https://www.phpbb.com/support/documentation/3.0/quickstart/quick_permissions.html">Chapter 1.5 of our Quick Start Guide</a>.</p>
',
'ACL_NEVER' => 'Never',
diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php
index 27ef714f8b..5ea151f6ea 100644
--- a/phpBB/language/en/acp/permissions_phpbb.php
+++ b/phpBB/language/en/acp/permissions_phpbb.php
@@ -33,207 +33,175 @@ if (empty($lang) || !is_array($lang))
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
/**
-* MODDERS PLEASE NOTE
+* EXTENSION-DEVELOPERS PLEASE NOTE
*
-* You are able to put your permission sets into a separate file too by
-* prefixing the new file with permissions_ and putting it into the acp
-* language folder.
-*
-* An example of how the file could look like:
-*
-* <code>
-*
-* if (empty($lang) || !is_array($lang))
-* {
-* $lang = array();
-* }
-*
-* // Adding new category
-* $lang['permission_cat']['bugs'] = 'Bugs';
-*
-* // Adding new permission set
-* $lang['permission_type']['bug_'] = 'Bug Permissions';
-*
-* // Adding the permissions
-* $lang = array_merge($lang, array(
-* 'acl_bug_view' => array('lang' => 'Can view bug reports', 'cat' => 'bugs'),
-* 'acl_bug_post' => array('lang' => 'Can post bugs', 'cat' => 'post'), // Using a phpBB category here
-* ));
-*
-* </code>
+* You are able to put your permission sets into your extension.
+* The permissions logic should be added via the 'core.permissions' event.
+* You can easily add new permission categories, types and permissions, by
+* simply merging them into the respective arrays.
+* The respective language strings should be added into a language file, that
+* start with 'permissions_', so they are automatically loaded within the ACP.
*/
-// Define categories and permission types
$lang = array_merge($lang, array(
- 'permission_cat' => array(
- 'actions' => 'Actions',
- 'content' => 'Content',
- 'forums' => 'Forums',
- 'misc' => 'Misc',
- 'permissions' => 'Permissions',
- 'pm' => 'Private messages',
- 'polls' => 'Polls',
- 'post' => 'Post',
- 'post_actions' => 'Post actions',
- 'posting' => 'Posting',
- 'profile' => 'Profile',
- 'settings' => 'Settings',
- 'topic_actions' => 'Topic actions',
- 'user_group' => 'Users &amp; Groups',
- ),
-
- // With defining 'global' here we are able to specify what is printed out if the permission is within the global scope.
- 'permission_type' => array(
- 'u_' => 'User permissions',
- 'a_' => 'Admin permissions',
- 'm_' => 'Moderator permissions',
- 'f_' => 'Forum permissions',
- 'global' => array(
- 'm_' => 'Global moderator permissions',
- ),
- ),
+ 'ACL_CAT_ACTIONS' => 'Actions',
+ 'ACL_CAT_CONTENT' => 'Content',
+ 'ACL_CAT_FORUMS' => 'Forums',
+ 'ACL_CAT_MISC' => 'Misc',
+ 'ACL_CAT_PERMISSIONS' => 'Permissions',
+ 'ACL_CAT_PM' => 'Private messages',
+ 'ACL_CAT_POLLS' => 'Polls',
+ 'ACL_CAT_POST' => 'Post',
+ 'ACL_CAT_POST_ACTIONS' => 'Post actions',
+ 'ACL_CAT_POSTING' => 'Posting',
+ 'ACL_CAT_PROFILE' => 'Profile',
+ 'ACL_CAT_SETTINGS' => 'Settings',
+ 'ACL_CAT_TOPIC_ACTIONS' => 'Topic actions',
+ 'ACL_CAT_USER_GROUP' => 'Users &amp; Groups',
));
// User Permissions
$lang = array_merge($lang, array(
- 'acl_u_viewprofile' => array('lang' => 'Can view profiles, memberlist and online list', 'cat' => 'profile'),
- 'acl_u_chgname' => array('lang' => 'Can change username', 'cat' => 'profile'),
- 'acl_u_chgpasswd' => array('lang' => 'Can change password', 'cat' => 'profile'),
- 'acl_u_chgemail' => array('lang' => 'Can change email address', 'cat' => 'profile'),
- 'acl_u_chgavatar' => array('lang' => 'Can change avatar', 'cat' => 'profile'),
- 'acl_u_chggrp' => array('lang' => 'Can change default usergroup', 'cat' => 'profile'),
- 'acl_u_chgprofileinfo' => array('lang' => 'Can change profile field information', 'cat' => 'profile'),
-
- 'acl_u_attach' => array('lang' => 'Can attach files', 'cat' => 'post'),
- 'acl_u_download' => array('lang' => 'Can download files', 'cat' => 'post'),
- 'acl_u_savedrafts' => array('lang' => 'Can save drafts', 'cat' => 'post'),
- 'acl_u_chgcensors' => array('lang' => 'Can disable word censors', 'cat' => 'post'),
- 'acl_u_sig' => array('lang' => 'Can use signature', 'cat' => 'post'),
-
- 'acl_u_sendpm' => array('lang' => 'Can send private messages', 'cat' => 'pm'),
- 'acl_u_masspm' => array('lang' => 'Can send messages to multiple users', 'cat' => 'pm'),
- 'acl_u_masspm_group'=> array('lang' => 'Can send messages to groups', 'cat' => 'pm'),
- 'acl_u_readpm' => array('lang' => 'Can read private messages', 'cat' => 'pm'),
- 'acl_u_pm_edit' => array('lang' => 'Can edit own private messages', 'cat' => 'pm'),
- 'acl_u_pm_delete' => array('lang' => 'Can remove private messages from own folder', 'cat' => 'pm'),
- 'acl_u_pm_forward' => array('lang' => 'Can forward private messages', 'cat' => 'pm'),
- 'acl_u_pm_emailpm' => array('lang' => 'Can email private messages', 'cat' => 'pm'),
- 'acl_u_pm_printpm' => array('lang' => 'Can print private messages', 'cat' => 'pm'),
- 'acl_u_pm_attach' => array('lang' => 'Can attach files in private messages', 'cat' => 'pm'),
- 'acl_u_pm_download' => array('lang' => 'Can download files in private messages', 'cat' => 'pm'),
- 'acl_u_pm_bbcode' => array('lang' => 'Can use BBCode in private messages', 'cat' => 'pm'),
- 'acl_u_pm_smilies' => array('lang' => 'Can use smilies in private messages', 'cat' => 'pm'),
- 'acl_u_pm_img' => array('lang' => 'Can use [img] BBCode tag in private messages', 'cat' => 'pm'),
- 'acl_u_pm_flash' => array('lang' => 'Can use [flash] BBCode tag in private messages', 'cat' => 'pm'),
-
- 'acl_u_sendemail' => array('lang' => 'Can send emails', 'cat' => 'misc'),
- 'acl_u_sendim' => array('lang' => 'Can send instant messages', 'cat' => 'misc'),
- 'acl_u_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'misc'),
- 'acl_u_hideonline' => array('lang' => 'Can hide online status', 'cat' => 'misc'),
- 'acl_u_viewonline' => array('lang' => 'Can view hidden online users', 'cat' => 'misc'),
- 'acl_u_search' => array('lang' => 'Can search board', 'cat' => 'misc'),
+ 'ACL_U_VIEWPROFILE' => 'Can view profiles, memberlist and online list',
+ 'ACL_U_CHGNAME' => 'Can change username',
+ 'ACL_U_CHGPASSWD' => 'Can change password',
+ 'ACL_U_CHGEMAIL' => 'Can change email address',
+ 'ACL_U_CHGAVATAR' => 'Can change avatar',
+ 'ACL_U_CHGGRP' => 'Can change default usergroup',
+ 'ACL_U_CHGPROFILEINFO' => 'Can change profile field information',
+
+ 'ACL_U_ATTACH' => 'Can attach files',
+ 'ACL_U_DOWNLOAD' => 'Can download files',
+ 'ACL_U_SAVEDRAFTS' => 'Can save drafts',
+ 'ACL_U_CHGCENSORS' => 'Can disable word censors',
+ 'ACL_U_SIG' => 'Can use signature',
+
+ 'ACL_U_SENDPM' => 'Can send private messages',
+ 'ACL_U_MASSPM' => 'Can send messages to multiple users',
+ 'ACL_U_MASSPM_GROUP'=> 'Can send messages to groups',
+ 'ACL_U_READPM' => 'Can read private messages',
+ 'ACL_U_PM_EDIT' => 'Can edit own private messages',
+ 'ACL_U_PM_DELETE' => 'Can remove private messages from own folder',
+ 'ACL_U_PM_FORWARD' => 'Can forward private messages',
+ 'ACL_U_PM_EMAILPM' => 'Can email private messages',
+ 'ACL_U_PM_PRINTPM' => 'Can print private messages',
+ 'ACL_U_PM_ATTACH' => 'Can attach files in private messages',
+ 'ACL_U_PM_DOWNLOAD' => 'Can download files in private messages',
+ 'ACL_U_PM_BBCODE' => 'Can use BBCode in private messages',
+ 'ACL_U_PM_SMILIES' => 'Can use smilies in private messages',
+ 'ACL_U_PM_IMG' => 'Can use [img] BBCode tag in private messages',
+ 'ACL_U_PM_FLASH' => 'Can use [flash] BBCode tag in private messages',
+
+ 'ACL_U_SENDEMAIL' => 'Can send emails',
+ 'ACL_U_SENDIM' => 'Can send instant messages',
+ 'ACL_U_IGNOREFLOOD' => 'Can ignore flood limit',
+ 'ACL_U_HIDEONLINE' => 'Can hide online status',
+ 'ACL_U_VIEWONLINE' => 'Can view hidden online users',
+ 'ACL_U_SEARCH' => 'Can search board',
));
// Forum Permissions
$lang = array_merge($lang, array(
- 'acl_f_list' => array('lang' => 'Can see forum', 'cat' => 'actions'),
- 'acl_f_read' => array('lang' => 'Can read forum', 'cat' => 'actions'),
- 'acl_f_search' => array('lang' => 'Can search the forum', 'cat' => 'actions'),
- 'acl_f_subscribe' => array('lang' => 'Can subscribe forum', 'cat' => 'actions'),
- 'acl_f_print' => array('lang' => 'Can print topics', 'cat' => 'actions'),
- 'acl_f_email' => array('lang' => 'Can email topics', 'cat' => 'actions'),
- 'acl_f_bump' => array('lang' => 'Can bump topics', 'cat' => 'actions'),
- 'acl_f_user_lock' => array('lang' => 'Can lock own topics', 'cat' => 'actions'),
- 'acl_f_download' => array('lang' => 'Can download files', 'cat' => 'actions'),
- 'acl_f_report' => array('lang' => 'Can report posts', 'cat' => 'actions'),
-
- 'acl_f_post' => array('lang' => 'Can start new topics', 'cat' => 'post'),
- 'acl_f_sticky' => array('lang' => 'Can post stickies', 'cat' => 'post'),
- 'acl_f_announce' => array('lang' => 'Can post announcements', 'cat' => 'post'),
- 'acl_f_reply' => array('lang' => 'Can reply to topics', 'cat' => 'post'),
- 'acl_f_edit' => array('lang' => 'Can edit own posts', 'cat' => 'post'),
- 'acl_f_delete' => array('lang' => 'Can delete own posts', 'cat' => 'post'),
- 'acl_f_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'post'),
- 'acl_f_postcount' => array('lang' => 'Increment post counter<br /><em>Please note that this setting only affects new posts.</em>', 'cat' => 'post'),
- 'acl_f_noapprove' => array('lang' => 'Can post without approval', 'cat' => 'post'),
-
- 'acl_f_attach' => array('lang' => 'Can attach files', 'cat' => 'content'),
- 'acl_f_icons' => array('lang' => 'Can use topic/post icons', 'cat' => 'content'),
- 'acl_f_bbcode' => array('lang' => 'Can use BBCode', 'cat' => 'content'),
- 'acl_f_flash' => array('lang' => 'Can use [flash] BBCode tag', 'cat' => 'content'),
- 'acl_f_img' => array('lang' => 'Can use [img] BBCode tag', 'cat' => 'content'),
- 'acl_f_sigs' => array('lang' => 'Can use signatures', 'cat' => 'content'),
- 'acl_f_smilies' => array('lang' => 'Can use smilies', 'cat' => 'content'),
-
- 'acl_f_poll' => array('lang' => 'Can create polls', 'cat' => 'polls'),
- 'acl_f_vote' => array('lang' => 'Can vote in polls', 'cat' => 'polls'),
- 'acl_f_votechg' => array('lang' => 'Can change existing vote', 'cat' => 'polls'),
+ 'ACL_F_LIST' => 'Can see forum',
+ 'ACL_F_READ' => 'Can read forum',
+ 'ACL_F_SEARCH' => 'Can search the forum',
+ 'ACL_F_SUBSCRIBE' => 'Can subscribe forum',
+ 'ACL_F_PRINT' => 'Can print topics',
+ 'ACL_F_EMAIL' => 'Can email topics',
+ 'ACL_F_BUMP' => 'Can bump topics',
+ 'ACL_F_USER_LOCK' => 'Can lock own topics',
+ 'ACL_F_DOWNLOAD' => 'Can download files',
+ 'ACL_F_REPORT' => 'Can report posts',
+
+ 'ACL_F_POST' => 'Can start new topics',
+ 'ACL_F_STICKY' => 'Can post stickies',
+ 'ACL_F_ANNOUNCE' => 'Can post announcements',
+ 'ACL_F_REPLY' => 'Can reply to topics',
+ 'ACL_F_EDIT' => 'Can edit own posts',
+ 'ACL_F_DELETE' => 'Can permanently delete own posts',
+ 'ACL_F_SOFTDELETE' => 'Can soft delete own posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>',
+ 'ACL_F_IGNOREFLOOD' => 'Can ignore flood limit',
+ 'ACL_F_POSTCOUNT' => 'Increment post counter<br /><em>Please note that this setting only affects new posts.</em>',
+ 'ACL_F_NOAPPROVE' => 'Can post without approval',
+
+ 'ACL_F_ATTACH' => 'Can attach files',
+ 'ACL_F_ICONS' => 'Can use topic/post icons',
+ 'ACL_F_BBCODE' => 'Can use BBCode',
+ 'ACL_F_FLASH' => 'Can use [flash] BBCode tag',
+ 'ACL_F_IMG' => 'Can use [img] BBCode tag',
+ 'ACL_F_SIGS' => 'Can use signatures',
+ 'ACL_F_SMILIES' => 'Can use smilies',
+
+ 'ACL_F_POLL' => 'Can create polls',
+ 'ACL_F_VOTE' => 'Can vote in polls',
+ 'ACL_F_VOTECHG' => 'Can change existing vote',
));
// Moderator Permissions
$lang = array_merge($lang, array(
- 'acl_m_edit' => array('lang' => 'Can edit posts', 'cat' => 'post_actions'),
- 'acl_m_delete' => array('lang' => 'Can delete posts', 'cat' => 'post_actions'),
- 'acl_m_approve' => array('lang' => 'Can approve posts', 'cat' => 'post_actions'),
- 'acl_m_report' => array('lang' => 'Can close and delete reports', 'cat' => 'post_actions'),
- 'acl_m_chgposter' => array('lang' => 'Can change post author', 'cat' => 'post_actions'),
-
- 'acl_m_move' => array('lang' => 'Can move topics', 'cat' => 'topic_actions'),
- 'acl_m_lock' => array('lang' => 'Can lock topics', 'cat' => 'topic_actions'),
- 'acl_m_split' => array('lang' => 'Can split topics', 'cat' => 'topic_actions'),
- 'acl_m_merge' => array('lang' => 'Can merge topics', 'cat' => 'topic_actions'),
-
- 'acl_m_info' => array('lang' => 'Can view post details', 'cat' => 'misc'),
- 'acl_m_warn' => array('lang' => 'Can issue warnings<br /><em>This setting is only assigned globally. It is not forum based.</em>', 'cat' => 'misc'), // This moderator setting is only global (and not local)
- 'acl_m_ban' => array('lang' => 'Can manage bans<br /><em>This setting is only assigned globally. It is not forum based.</em>', 'cat' => 'misc'), // This moderator setting is only global (and not local)
+ 'ACL_M_EDIT' => 'Can edit posts',
+ 'ACL_M_DELETE' => 'Can permanently delete posts',
+ 'ACL_M_SOFTDELETE' => 'Can soft delete posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>',
+ 'ACL_M_APPROVE' => 'Can approve posts',
+ 'ACL_M_REPORT' => 'Can close and delete reports',
+ 'ACL_M_CHGPOSTER' => 'Can change post author',
+
+ 'ACL_M_MOVE' => 'Can move topics',
+ 'ACL_M_LOCK' => 'Can lock topics',
+ 'ACL_M_SPLIT' => 'Can split topics',
+ 'ACL_M_MERGE' => 'Can merge topics',
+
+ 'ACL_M_INFO' => 'Can view post details',
+ 'ACL_M_WARN' => 'Can issue warnings<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local)
+ 'ACL_M_BAN' => 'Can manage bans<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local)
));
// Admin Permissions
$lang = array_merge($lang, array(
- 'acl_a_board' => array('lang' => 'Can alter board settings/check for updates', 'cat' => 'settings'),
- 'acl_a_server' => array('lang' => 'Can alter server/communication settings', 'cat' => 'settings'),
- 'acl_a_jabber' => array('lang' => 'Can alter Jabber settings', 'cat' => 'settings'),
- 'acl_a_phpinfo' => array('lang' => 'Can view php settings', 'cat' => 'settings'),
-
- 'acl_a_forum' => array('lang' => 'Can manage forums', 'cat' => 'forums'),
- 'acl_a_forumadd' => array('lang' => 'Can add new forums', 'cat' => 'forums'),
- 'acl_a_forumdel' => array('lang' => 'Can delete forums', 'cat' => 'forums'),
- 'acl_a_prune' => array('lang' => 'Can prune forums', 'cat' => 'forums'),
-
- 'acl_a_icons' => array('lang' => 'Can alter topic/post icons and smilies', 'cat' => 'posting'),
- 'acl_a_words' => array('lang' => 'Can alter word censors', 'cat' => 'posting'),
- 'acl_a_bbcode' => array('lang' => 'Can define BBCode tags', 'cat' => 'posting'),
- 'acl_a_attach' => array('lang' => 'Can alter attachment related settings', 'cat' => 'posting'),
-
- 'acl_a_user' => array('lang' => 'Can manage users<br /><em>This also includes seeing the users browser agent within the viewonline list.</em>', 'cat' => 'user_group'),
- 'acl_a_userdel' => array('lang' => 'Can delete/prune users', 'cat' => 'user_group'),
- 'acl_a_group' => array('lang' => 'Can manage groups', 'cat' => 'user_group'),
- 'acl_a_groupadd' => array('lang' => 'Can add new groups', 'cat' => 'user_group'),
- 'acl_a_groupdel' => array('lang' => 'Can delete groups', 'cat' => 'user_group'),
- 'acl_a_ranks' => array('lang' => 'Can manage ranks', 'cat' => 'user_group'),
- 'acl_a_profile' => array('lang' => 'Can manage custom profile fields', 'cat' => 'user_group'),
- 'acl_a_names' => array('lang' => 'Can manage disallowed names', 'cat' => 'user_group'),
- 'acl_a_ban' => array('lang' => 'Can manage bans', 'cat' => 'user_group'),
-
- 'acl_a_viewauth' => array('lang' => 'Can view permission masks', 'cat' => 'permissions'),
- 'acl_a_authgroups' => array('lang' => 'Can alter permissions for individual groups', 'cat' => 'permissions'),
- 'acl_a_authusers' => array('lang' => 'Can alter permissions for individual users', 'cat' => 'permissions'),
- 'acl_a_fauth' => array('lang' => 'Can alter forum permission class', 'cat' => 'permissions'),
- 'acl_a_mauth' => array('lang' => 'Can alter moderator permission class', 'cat' => 'permissions'),
- 'acl_a_aauth' => array('lang' => 'Can alter admin permission class', 'cat' => 'permissions'),
- 'acl_a_uauth' => array('lang' => 'Can alter user permission class', 'cat' => 'permissions'),
- 'acl_a_roles' => array('lang' => 'Can manage roles', 'cat' => 'permissions'),
- 'acl_a_switchperm' => array('lang' => 'Can use others permissions', 'cat' => 'permissions'),
-
- 'acl_a_styles' => array('lang' => 'Can manage styles', 'cat' => 'misc'),
- 'acl_a_extensions' => array('lang' => 'Can manage extensions', 'cat' => 'misc'),
- 'acl_a_viewlogs' => array('lang' => 'Can view logs', 'cat' => 'misc'),
- 'acl_a_clearlogs' => array('lang' => 'Can clear logs', 'cat' => 'misc'),
- 'acl_a_modules' => array('lang' => 'Can manage modules', 'cat' => 'misc'),
- 'acl_a_language' => array('lang' => 'Can manage language packs', 'cat' => 'misc'),
- 'acl_a_email' => array('lang' => 'Can send mass email', 'cat' => 'misc'),
- 'acl_a_bots' => array('lang' => 'Can manage bots', 'cat' => 'misc'),
- 'acl_a_reasons' => array('lang' => 'Can manage report/denial reasons', 'cat' => 'misc'),
- 'acl_a_backup' => array('lang' => 'Can backup/restore database', 'cat' => 'misc'),
- 'acl_a_search' => array('lang' => 'Can manage search backends and settings', 'cat' => 'misc'),
+ 'ACL_A_BOARD' => 'Can alter board settings/check for updates',
+ 'ACL_A_SERVER' => 'Can alter server/communication settings',
+ 'ACL_A_JABBER' => 'Can alter Jabber settings',
+ 'ACL_A_PHPINFO' => 'Can view php settings',
+
+ 'ACL_A_FORUM' => 'Can manage forums',
+ 'ACL_A_FORUMADD' => 'Can add new forums',
+ 'ACL_A_FORUMDEL' => 'Can delete forums',
+ 'ACL_A_PRUNE' => 'Can prune forums',
+
+ 'ACL_A_ICONS' => 'Can alter topic/post icons and smilies',
+ 'ACL_A_WORDS' => 'Can alter word censors',
+ 'ACL_A_BBCODE' => 'Can define BBCode tags',
+ 'ACL_A_ATTACH' => 'Can alter attachment related settings',
+
+ 'ACL_A_USER' => 'Can manage users<br /><em>This also includes seeing the users browser agent within the viewonline list.</em>',
+ 'ACL_A_USERDEL' => 'Can delete/prune users',
+ 'ACL_A_GROUP' => 'Can manage groups',
+ 'ACL_A_GROUPADD' => 'Can add new groups',
+ 'ACL_A_GROUPDEL' => 'Can delete groups',
+ 'ACL_A_RANKS' => 'Can manage ranks',
+ 'ACL_A_PROFILE' => 'Can manage custom profile fields',
+ 'ACL_A_NAMES' => 'Can manage disallowed names',
+ 'ACL_A_BAN' => 'Can manage bans',
+
+ 'ACL_A_VIEWAUTH' => 'Can view permission masks',
+ 'ACL_A_AUTHGROUPS' => 'Can alter permissions for individual groups',
+ 'ACL_A_AUTHUSERS' => 'Can alter permissions for individual users',
+ 'ACL_A_FAUTH' => 'Can alter forum permission class',
+ 'ACL_A_MAUTH' => 'Can alter moderator permission class',
+ 'ACL_A_AAUTH' => 'Can alter admin permission class',
+ 'ACL_A_UAUTH' => 'Can alter user permission class',
+ 'ACL_A_ROLES' => 'Can manage roles',
+ 'ACL_A_SWITCHPERM' => 'Can use others permissions',
+
+ 'ACL_A_STYLES' => 'Can manage styles',
+ 'ACL_A_EXTENSIONS' => 'Can manage extensions',
+ 'ACL_A_VIEWLOGS' => 'Can view logs',
+ 'ACL_A_CLEARLOGS' => 'Can clear logs',
+ 'ACL_A_MODULES' => 'Can manage modules',
+ 'ACL_A_LANGUAGE' => 'Can manage language packs',
+ 'ACL_A_EMAIL' => 'Can send mass email',
+ 'ACL_A_BOTS' => 'Can manage bots',
+ 'ACL_A_REASONS' => 'Can manage report/denial reasons',
+ 'ACL_A_BACKUP' => 'Can backup/restore database',
+ 'ACL_A_SEARCH' => 'Can manage search backends and settings',
));
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 7c7afd83f4..b188d90f3a 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -519,8 +519,12 @@ $lang = array_merge($lang, array(
'POSTS' => 'Posts',
'POSTS_UNAPPROVED' => 'At least one post in this topic has not been approved.',
'POST_BY_AUTHOR' => 'by',
- 'POST_BY_FOE' => 'This post was made by <strong>%1$s</strong> who is currently on your ignore list. %2$sDisplay this post%3$s.',
+ 'POST_BY_FOE' => '<strong>%1$s</strong>, who is currently on your ignore list, made this post.',
+ 'POST_DISPLAY' => '%1$sDisplay this post%2$s.',
'POST_DAY' => '%.2f posts per day',
+ 'POST_DELETED' => 'Deleted post:',
+ 'POST_DELETED_BY' => '<strong>%2$s</strong> deleted the post by <strong>%1$s</strong> on %3$s.',
+ 'POST_DELETED_BY_REASON'=> '<strong>%2$s</strong> deleted the post by <strong>%1$s</strong> on %3$s for the following reason: %4$s',
'POST_DETAILS' => 'Post details',
'POST_NEW_TOPIC' => 'Post new topic',
'POST_PCT' => '%.2f%% of all posts',
diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php
index 9500943b88..68dc05f992 100644
--- a/phpBB/language/en/help_faq.php
+++ b/phpBB/language/en/help_faq.php
@@ -328,7 +328,7 @@ $help = array(
),
array(
0 => 'Who wrote this bulletin board?',
- 1 => 'This software (in its unmodified form) is produced, released and is copyright <a href="http://www.phpbb.com/">phpBB Group</a>. It is made available under the GNU General Public License and may be freely distributed. See the link for more details.'
+ 1 => 'This software (in its unmodified form) is produced, released and is copyright <a href="https://www.phpbb.com/">phpBB Group</a>. It is made available under the GNU General Public License and may be freely distributed. See the link for more details.'
),
array(
0 => 'Why isn’t X feature available?',
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 7b2a1138e9..be45047861 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -78,7 +78,7 @@ $lang = array_merge($lang, array(
'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion',
'CONVERT' => 'Convert',
'CONVERT_COMPLETE' => 'Conversion completed',
- 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and <a href="../">access your board</a>. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the <a href="http://www.phpbb.com/support/documentation/3.0/">Documentation</a> and the <a href="http://www.phpbb.com/community/viewforum.php?f=46">support forums</a>.',
+ 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and <a href="../">access your board</a>. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the <a href="https://www.phpbb.com/support/documentation/3.0/">Documentation</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=46">support forums</a>.',
'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework',
'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.',
'CONVERT_NEW_CONVERSION' => 'New conversion',
@@ -192,7 +192,7 @@ $lang = array_merge($lang, array(
<h2>Convert an existing board to phpBB3</h2>
<p>The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please <a href="%2$s">proceed to the convertor</a>.</p>
<h2>Go live with your phpBB3!</h2>
- <p>Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the <a href="http://www.phpbb.com/support/documentation/3.0/">Documentation</a>, <a href="%3$s">README</a> and the <a href="http://www.phpbb.com/community/viewforum.php?f=46">Support Forums</a>.</p><p><strong>Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.</strong>',
+ <p>Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the <a href="https://www.phpbb.com/support/documentation/3.0/">Documentation</a>, <a href="%3$s">README</a> and the <a href="https://www.phpbb.com/community/viewforum.php?f=46">Support Forums</a>.</p><p><strong>Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.</strong>',
'INSTALL_INTRO' => 'Welcome to Installation',
'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.</p><p>In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:</p>
@@ -275,7 +275,7 @@ $lang = array_merge($lang, array(
'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again:<br />»<strong>%s</strong>.',
'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again:<br />»<strong>%s</strong>.',
- 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.<br /><strong>Before you proceed the update, you need to upgrade the schema.</strong><br /><br />Please refer to the <a href="http://www.phpbb.com/kb/article/doesnt-have-a-default-value-errors/">Knowledge Base article about upgrading the MySQL schema</a>. If you encounter problems, please use <a href="http://www.phpbb.com/community/viewforum.php?f=46">our support forums</a>.',
+ 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.<br /><strong>Before you proceed the update, you need to upgrade the schema.</strong><br /><br />Please refer to the <a href="https://www.phpbb.com/kb/article/doesnt-have-a-default-value-errors/">Knowledge Base article about upgrading the MySQL schema</a>. If you encounter problems, please use <a href="https://www.phpbb.com/community/viewforum.php?f=46">our support forums</a>.',
'NAMING_CONFLICT' => 'Naming conflict: %s and %s are both aliases<br /><br />%s',
'NEXT_STEP' => 'Proceed to next step',
@@ -286,7 +286,7 @@ $lang = array_merge($lang, array(
'NO_LOCATION' => 'Cannot determine location. If you know Imagemagick is installed, you may specify the location later within your administration control panel',
'NO_TABLES_FOUND' => 'No tables found.',
- 'OVERVIEW_BODY' => 'Welcome to phpBB3!<br /><br />phpBB™ is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.<br /><br />This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read <a href="../docs/INSTALL.html">the installation guide</a>.<br /><br />To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.',
+ 'OVERVIEW_BODY' => 'Welcome to phpBB3!<br /><br />phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.<br /><br />This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read <a href="../docs/INSTALL.html">the installation guide</a>.<br /><br />To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.',
'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support',
'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will <strong>not</strong> run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.',
@@ -346,7 +346,7 @@ $lang = array_merge($lang, array(
'SUB_LICENSE' => 'License',
'SUB_SUPPORT' => 'Support',
'SUCCESSFUL_CONNECT' => 'Successful connection',
- 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:</p><ul><li>installation</li><li>configuration</li><li>technical questions</li><li>problems relating to potential bugs in the software</li><li>updating from Release Candidate (RC) versions to the latest stable version</li><li>converting from phpBB 2.0.x to phpBB3</li><li>converting from other discussion board software to phpBB3 (please see the <a href="http://www.phpbb.com/community/viewforum.php?f=65">Convertors Forum</a>)</li></ul><p>We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.</p><h2>MODs / Styles</h2><p>For issues relating to MODs, please post in the appropriate <a href="http://www.phpbb.com/community/viewforum.php?f=81">Modifications Forum</a>.<br />For issues relating to styles, templates and themes, please post in the appropriate <a href="http://www.phpbb.com/community/viewforum.php?f=80">Styles Forum</a>.<br /><br />If your question relates to a specific package, please post directly in the topic dedicated to the package.</p><h2>Obtaining Support</h2><p><a href="http://www.phpbb.com/community/viewtopic.php?f=14&amp;t=571070">The phpBB Welcome Package</a><br /><a href="http://www.phpbb.com/support/">Support Section</a><br /><a href="http://www.phpbb.com/support/documentation/3.0/quickstart/">Quick Start Guide</a><br /><br />To ensure you stay up to date with the latest news and releases, why not <a href="http://www.phpbb.com/support/">subscribe to our mailing list</a>?<br /><br />',
+ 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:</p><ul><li>installation</li><li>configuration</li><li>technical questions</li><li>problems relating to potential bugs in the software</li><li>updating from Release Candidate (RC) versions to the latest stable version</li><li>converting from phpBB 2.0.x to phpBB3</li><li>converting from other discussion board software to phpBB3 (please see the <a href="https://www.phpbb.com/community/viewforum.php?f=65">Convertors Forum</a>)</li></ul><p>We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.</p><h2>MODs / Styles</h2><p>For issues relating to MODs, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=81">Modifications Forum</a>.<br />For issues relating to styles, templates and themes, please post in the appropriate <a href="https://www.phpbb.com/community/viewforum.php?f=80">Styles Forum</a>.<br /><br />If your question relates to a specific package, please post directly in the topic dedicated to the package.</p><h2>Obtaining Support</h2><p><a href="https://www.phpbb.com/community/viewtopic.php?f=14&amp;t=571070">The phpBB Welcome Package</a><br /><a href="https://www.phpbb.com/support/">Support Section</a><br /><a href="https://www.phpbb.com/support/documentation/3.0/quickstart/">Quick Start Guide</a><br /><br />To ensure you stay up to date with the latest news and releases, why not <a href="https://www.phpbb.com/support/">subscribe to our mailing list</a>?<br /><br />',
'SYNC_FORUMS' => 'Starting to synchronise forums',
'SYNC_POST_COUNT' => 'Synchronising post_counts',
'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from <var>entry</var> %1$s to %2$s.',
@@ -472,7 +472,7 @@ $lang = array_merge($lang, array(
'NO_ERRORS' => 'No errors',
'NO_UPDATE_FILES' => 'Not updating the following files',
'NO_UPDATE_FILES_EXPLAIN' => 'The following files are new or modified but the directory they normally reside in could not be found on your installation. If this list contains files to other directories than language/ or styles/ than you may have modified your directory structure and the update may be incomplete.',
- 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.<br /><br />Your installation does <strong>not</strong> seem to be up to date. Updates are available for your version of phpBB %1$s, please visit <a href="http://www.phpbb.com/downloads/" rel="external">http://www.phpbb.com/downloads/</a> to obtain the correct package to update from Version %2$s to Version %3$s.',
+ 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.<br /><br />Your installation does <strong>not</strong> seem to be up to date. Updates are available for your version of phpBB %1$s, please visit <a href="https://www.phpbb.com/downloads/" rel="external">https://www.phpbb.com/downloads/</a> to obtain the correct package to update from Version %2$s to Version %3$s.',
'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.',
'NO_UPDATE_INFO' => 'Update file information could not be found.',
'NO_UPDATES_REQUIRED' => 'No updates required',
@@ -540,7 +540,7 @@ $lang = array_merge($lang, array(
<p>The recommended way of updating your installation listed here is only valid for the automatic update package. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 automatically are:</p>
<ul style="margin-left: 20px; font-size: 1.1em;">
- <li>Go to the <a href="http://www.phpbb.com/downloads/" title="http://www.phpbb.com/downloads/">phpBB.com downloads page</a> and download the "Automatic Update Package" archive.<br /><br /></li>
+ <li>Go to the <a href="https://www.phpbb.com/downloads/" title="https://www.phpbb.com/downloads/">phpBB.com downloads page</a> and download the "Automatic Update Package" archive.<br /><br /></li>
<li>Unpack the archive.<br /><br /></li>
<li>Upload the complete uncompressed install folder to your phpBB root directory (where your config.php file is).<br /><br /></li>
</ul>
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index 29f418183f..b75e0ea495 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -52,6 +52,10 @@ $lang = array_merge($lang, array(
'APPROVE_POST_CONFIRM' => 'Are you sure you want to approve this post?',
'APPROVE_POSTS' => 'Approve posts',
'APPROVE_POSTS_CONFIRM' => 'Are you sure you want to approve the selected posts?',
+ 'APPROVE_TOPIC' => 'Approve topic',
+ 'APPROVE_TOPIC_CONFIRM' => 'Are you sure you want to approve this topic?',
+ 'APPROVE_TOPICS' => 'Approve topics',
+ 'APPROVE_TOPICS_CONFIRM'=> 'Are you sure you want to approve the selected topics?',
'CANNOT_MOVE_SAME_FORUM'=> 'You cannot move a topic to the forum it’s already in.',
'CANNOT_WARN_ANONYMOUS' => 'You cannot warn unregistered guest users.',
@@ -72,16 +76,12 @@ $lang = array_merge($lang, array(
'DELETE_PM_REPORTS' => 'Delete PM reports',
'DELETE_PM_REPORTS_CONFIRM' => 'Are you sure you want to delete the selected PM reports?',
'DELETE_POSTS' => 'Delete posts',
- 'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?',
- 'DELETE_POST_CONFIRM' => 'Are you sure you want to delete this post?',
'DELETE_REPORT' => 'Delete report',
'DELETE_REPORT_CONFIRM' => 'Are you sure you want to delete the selected report?',
'DELETE_REPORTS' => 'Delete reports',
'DELETE_REPORTS_CONFIRM' => 'Are you sure you want to delete the selected reports?',
'DELETE_SHADOW_TOPIC' => 'Delete shadow topic',
'DELETE_TOPICS' => 'Delete selected topics',
- 'DELETE_TOPICS_CONFIRM' => 'Are you sure you want to delete these topics?',
- 'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?',
'DISAPPROVE' => 'Disapprove',
'DISAPPROVE_REASON' => 'Reason for disapproval',
'DISAPPROVE_POST' => 'Disapprove post',
@@ -201,6 +201,10 @@ $lang = array_merge($lang, array(
'MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN' => 'This is a list of all posts which require approving before they will be visible to users.',
'MCP_QUEUE_UNAPPROVED_TOPICS' => 'Topics awaiting approval',
'MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN' => 'This is a list of all topics which require approving before they will be visible to users.',
+ 'MCP_QUEUE_DELETED_POSTS' => 'Deleted posts',
+ 'MCP_QUEUE_DELETED_POSTS_EXPLAIN' => 'This is a list of all soft deleted posts. You can restore or permanently delete the posts from this screen.',
+ 'MCP_QUEUE_DELETED_TOPICS' => 'Deleted topics',
+ 'MCP_QUEUE_DELETED_TOPICS_EXPLAIN' => 'This is a list of all soft deleted topics. You can restore or permanently delete the topics from this screen.',
'MCP_VIEW_USER' => 'View warnings for a specific user',
@@ -238,6 +242,7 @@ $lang = array_merge($lang, array(
'NO_POST' => 'You have to select a post in order to warn the user for a post.',
'NO_POST_REPORT' => 'This post was not reported.',
'NO_POST_SELECTED' => 'You must select at least one post to perform this action.',
+ 'NO_POSTS_DELETED' => 'There are no deleted posts.',
'NO_POSTS_QUEUE' => 'There are no posts waiting for approval.',
'NO_REASON_DISAPPROVAL' => 'Please give an appropriate reason for disapproval.',
'NO_REPORT' => 'No report found',
@@ -245,6 +250,7 @@ $lang = array_merge($lang, array(
'NO_REPORT_SELECTED' => 'You must select at least one report to perform this action.',
'NO_TOPIC_ICON' => 'None',
'NO_TOPIC_SELECTED' => 'You must select at least one topic to perform this action.',
+ 'NO_TOPICS_DELETED' => 'There are no deleted topics.',
'NO_TOPICS_QUEUE' => 'There are no topics waiting for approval.',
'ONLY_TOPIC' => 'Only topic “%s”',
@@ -269,15 +275,17 @@ $lang = array_merge($lang, array(
'POSTS_DISAPPROVED_SUCCESS' => 'The selected posts have been disapproved.',
'POSTS_LOCKED_SUCCESS' => 'The selected posts have been locked successfully.',
'POSTS_MERGED_SUCCESS' => 'The selected posts have been merged.',
- 'POSTS_UNLOCKED_SUCCESS' => 'The selected posts have been unlocked successfully.',
'POSTS_PER_PAGE' => 'Posts per page',
'POSTS_PER_PAGE_EXPLAIN' => '(Set to 0 to view all posts.)',
+ 'POSTS_RESTORED_SUCCESS' => 'The selected posts have been restored successfully.',
+ 'POSTS_UNLOCKED_SUCCESS' => 'The selected posts have been unlocked successfully.',
'POST_APPROVED_SUCCESS' => 'The selected post has been approved.',
'POST_DELETED_SUCCESS' => 'The selected post has been successfully removed from the database.',
'POST_DISAPPROVED_SUCCESS' => 'The selected post has been disapproved.',
'POST_LOCKED_SUCCESS' => 'Post locked successfully.',
'POST_NOT_EXIST' => 'The post you requested does not exist.',
'POST_REPORTED_SUCCESS' => 'This post has been successfully reported.',
+ 'POST_RESTORED_SUCCESS' => 'This post has been restored successfully.',
'POST_UNLOCKED_SUCCESS' => 'Post unlocked successfully.',
'READ_USERNOTES' => 'User notes',
@@ -304,6 +312,15 @@ $lang = array_merge($lang, array(
'REPORT_POST_EXPLAIN' => 'Use this form to report the selected post to the forum moderators and board administrators. Reporting should generally be used only if the post breaks forum rules.',
'REPORT_REASON' => 'Report reason',
'REPORT_TIME' => 'Report time',
+ 'RESTORE' => 'Restore',
+ 'RESTORE_POST' => 'Restore post',
+ 'RESTORE_POST_CONFIRM' => 'Are you sure you want to restore this post?',
+ 'RESTORE_POSTS' => 'Restore posts',
+ 'RESTORE_POSTS_CONFIRM' => 'Are you sure you want to restore the selected posts?',
+ 'RESTORE_TOPIC' => 'Restore topic',
+ 'RESTORE_TOPIC_CONFIRM' => 'Are you sure you want to restore this topic?',
+ 'RESTORE_TOPICS' => 'Restore topics',
+ 'RESTORE_TOPICS_CONFIRM' => 'Are you sure you want to restore the selected topics?',
'RESYNC' => 'Resync',
'RETURN_MESSAGE' => '%sReturn to the message%s',
'RETURN_NEW_FORUM' => '%sGo to the new forum%s',
@@ -344,6 +361,7 @@ $lang = array_merge($lang, array(
'TOPICS_FORKED_SUCCESS' => 'The selected topics have been copied successfully.',
'TOPICS_LOCKED_SUCCESS' => 'The selected topics have been locked.',
'TOPICS_MOVED_SUCCESS' => 'The selected topics have been moved successfully.',
+ 'TOPICS_RESTORED_SUCCESS' => 'The selected topics have been restored successfully.',
'TOPICS_RESYNC_SUCCESS' => 'The selected topics have been resynchronised.',
'TOPICS_TYPE_CHANGED' => 'Topic types changed successfully.',
'TOPICS_UNLOCKED_SUCCESS' => 'The selected topics have been unlocked.',
@@ -354,6 +372,7 @@ $lang = array_merge($lang, array(
'TOPIC_LOCKED_SUCCESS' => 'The selected topic has been locked.',
'TOPIC_MOVED_SUCCESS' => 'The selected topic has been moved successfully.',
'TOPIC_NOT_EXIST' => 'The topic you selected does not exist.',
+ 'TOPIC_RESTORED_SUCCESS' => 'The selected topic has been restored successfully.',
'TOPIC_RESYNC_SUCCESS' => 'The selected topic has been resynchronised.',
'TOPIC_SPLIT_SUCCESS' => 'The selected topic has been split successfully.',
'TOPIC_TIME' => 'Topic time',
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 7651ff2b63..0e8d59a92e 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -77,8 +77,20 @@ $lang = array_merge($lang, array(
'DELETE_MESSAGE' => 'Delete message',
'DELETE_MESSAGE_CONFIRM' => 'Are you sure you want to delete this message?',
'DELETE_OWN_POSTS' => 'Sorry but you can only delete your own posts.',
+ 'DELETE_PERMANENTLY' => 'Delete permanently',
'DELETE_POST_CONFIRM' => 'Are you sure you want to delete this post?',
- 'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered',
+ 'DELETE_POST_PERMANENTLY_CONFIRM' => 'Are you sure you want to <strong>permanently</strong> delete this post?',
+ 'DELETE_POST_PERMANENTLY' => 'Permanently delete this post so it can not be recovered',
+ 'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?',
+ 'DELETE_POSTS_PERMANENTLY_CONFIRM' => 'Are you sure you want to <strong>permanently</strong> delete these posts?',
+ 'DELETE_REASON' => 'Soft delete reason',
+ 'DELETE_REASON_EXPLAIN' => 'The specified reason for deletion will be visible to moderators.',
+ 'DELETE_POST_WARN' => 'Deleted this post',
+ 'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?',
+ 'DELETE_TOPIC_PERMANENTLY' => 'Permanently delete this topic so it can not be recovered',
+ 'DELETE_TOPIC_PERMANENTLY_CONFIRM' => 'Are you sure you want to <strong>permanently</strong> delete this topic?',
+ 'DELETE_TOPICS_CONFIRM' => 'Are you sure you want to delete these topics?',
+ 'DELETE_TOPICS_PERMANENTLY_CONFIRM' => 'Are you sure you want to <strong>permanently</strong> delete these topics?',
'DISABLE_BBCODE' => 'Disable BBCode',
'DISABLE_MAGIC_URL' => 'Do not automatically parse URLs',
'DISABLE_SMILIES' => 'Disable smilies',
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index a91b6b84d5..51823ddb12 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -38,7 +38,7 @@ if (empty($lang) || !is_array($lang))
$lang = array_merge($lang, array(
'TERMS_OF_USE_CONTENT' => 'By accessing “%1$s” (hereinafter “we”, “us”, “our”, “%1$s”, “%2$s”), you agree to be legally bound by the following terms. If you do not agree to be legally bound by all of the following terms then please do not access and/or use “%1$s”. We may change these at any time and we’ll do our utmost in informing you, though it would be prudent to review this regularly yourself as your continued usage of “%1$s” after changes mean you agree to be legally bound by these terms as they are updated and/or amended.<br />
<br />
- Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Group”, “phpBB Teams”) which is a bulletin board solution released under the “<a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>” (hereinafter “GPL”) and can be downloaded from <a href="http://www.phpbb.com/">www.phpbb.com</a>. The phpBB software only facilitates internet based discussions, the phpBB Group are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: <a href="http://www.phpbb.com/">http://www.phpbb.com/</a>.<br />
+ Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Group”, “phpBB Teams”) which is a bulletin board solution released under the “<a href="http://opensource.org/licenses/gpl-2.0.php">GNU General Public License v2</a>” (hereinafter “GPL”) and can be downloaded from <a href="https://www.phpbb.com/">www.phpbb.com</a>. The phpBB software only facilitates internet based discussions, the phpBB Group are not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: <a href="https://www.phpbb.com/">https://www.phpbb.com/</a>.<br />
<br />
You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where “%1$s” is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that “%1$s” have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither “%1$s” nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised.
',
diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php
index 278c064fe7..6f318c39f1 100644
--- a/phpBB/language/en/viewtopic.php
+++ b/phpBB/language/en/viewtopic.php
@@ -50,6 +50,7 @@ $lang = array_merge($lang, array(
'CODE' => 'Code',
'DELETE_TOPIC' => 'Delete topic',
+ 'DELETED_INFORMATION' => 'Deleted by %1$s on %2$s',
'DISAPPROVE' => 'Disapprove',
'DOWNLOAD_NOTICE' => 'You do not have the required permissions to view the files attached to this post.',
@@ -89,6 +90,7 @@ $lang = array_merge($lang, array(
'POLL_ENDED_AT' => 'Poll ended at %s',
'POLL_RUN_TILL' => 'Poll runs till %s',
'POLL_VOTED_OPTION' => 'You voted for this option',
+ 'POST_DELETED_RESTORE' => 'This post has been deleted. It can be restored.',
'PRINT_TOPIC' => 'Print view',
'QUICK_MOD' => 'Quick-mod tools',
@@ -96,6 +98,8 @@ $lang = array_merge($lang, array(
'QUOTE' => 'Quote',
'REPLY_TO_TOPIC' => 'Reply to topic',
+ 'RESTORE' => 'Restore',
+ 'RESTORE_TOPIC' => 'Restore topic',
'RETURN_POST' => '%sReturn to the post%s',
'SUBMIT_VOTE' => 'Submit vote',
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index c36faad74b..5beea45c7d 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -158,6 +158,7 @@ if ($quickmod)
case 'move':
case 'delete_post':
case 'delete_topic':
+ case 'restore_topic':
$module->load('mcp', 'main', 'quickmod');
return;
break;
@@ -199,7 +200,7 @@ if (!$post_id)
$module->set_display('warn', 'warn_post', false);
}
-if ($mode == '' || $mode == 'unapproved_topics' || $mode == 'unapproved_posts')
+if ($mode == '' || $mode == 'unapproved_topics' || $mode == 'unapproved_posts' || $mode == 'deleted_topics' || $mode == 'deleted_posts')
{
$module->set_display('queue', 'approve_details', false);
}
@@ -483,7 +484,7 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false)
continue;
}
- if (!$row['post_approved'] && !$auth->acl_get('m_approve', $row['forum_id']))
+ if ($row['post_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $row['forum_id']))
{
// Moderators without the permission to approve post should at least not see them. ;)
continue;
@@ -501,7 +502,7 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false)
*/
function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
{
- global $auth, $db, $user, $config;
+ global $auth, $db, $user, $config, $phpbb_container;
$rowset = array();
@@ -531,6 +532,8 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
WHERE " . $db->sql_in_set('f.forum_id', $forum_id);
$result = $db->sql_query($sql);
+ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
while ($row = $db->sql_fetchrow($result))
{
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
@@ -538,10 +541,7 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
continue;
}
- if ($auth->acl_get('m_approve', $row['forum_id']))
- {
- $row['forum_topics'] = $row['forum_topics_real'];
- }
+ $row['forum_topics_approved'] = $phpbb_content_visibility->get_count('forum_topics', $row, $row['forum_id']);
$rowset[$row['forum_id']] = $row;
}
@@ -619,7 +619,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
if (!$auth->acl_get('m_approve', $forum_id))
{
- $sql .= 'AND topic_approved = 1';
+ $sql .= 'AND topic_visibility = ' . ITEM_APPROVED;
}
break;
@@ -635,11 +635,13 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
if (!$auth->acl_get('m_approve', $forum_id))
{
- $sql .= 'AND post_approved = 1';
+ $sql .= 'AND post_visibility = ' . ITEM_APPROVED;
}
break;
case 'unapproved_posts':
+ case 'deleted_posts':
+ $visibility_const = ($mode == 'unapproved_posts') ? ITEM_UNAPPROVED : ITEM_DELETED;
$type = 'posts';
$default_key = 't';
$default_dir = 'd';
@@ -648,9 +650,9 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
$sql = 'SELECT COUNT(p.post_id) AS total
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
$where_sql " . $db->sql_in_set('p.forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
- AND p.post_approved = 0
+ AND p.post_visibility = ' . $visibility_const . '
AND t.topic_id = p.topic_id
- AND t.topic_first_post_id <> p.post_id';
+ AND t.topic_visibility <> p.post_visibility';
if ($min_time)
{
@@ -659,6 +661,8 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
break;
case 'unapproved_topics':
+ case 'deleted_topics':
+ $visibility_const = ($mode == 'unapproved_topics') ? ITEM_UNAPPROVED : ITEM_DELETED;
$type = 'topics';
$default_key = 't';
$default_dir = 'd';
@@ -666,7 +670,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
$sql = 'SELECT COUNT(topic_id) AS total
FROM ' . TOPICS_TABLE . "
$where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
- AND topic_approved = 0';
+ AND topic_visibility = ' . $visibility_const;
if ($min_time)
{
@@ -748,7 +752,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
- $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_replies_real' : 't.topic_replies'), 's' => 't.topic_title', 'v' => 't.topic_views');
+ $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
$limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : '';
break;
@@ -796,7 +800,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
'S_SELECT_SORT_DAYS' => $s_limit_days)
);
- if (($sort_days && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts')) || $where_sql != 'WHERE')
+ if (($sort_days && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts', 'deleted_topics', 'deleted_posts')) || $where_sql != 'WHERE')
{
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 7ecf332720..46136dbdd4 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -638,7 +638,7 @@ switch ($mode)
$sql = 'SELECT COUNT(post_id) as posts_in_queue
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $user_id . '
- AND post_approved = 0';
+ AND post_visibility = ' . ITEM_UNAPPROVED;
$result = $db->sql_query($sql);
$member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
$db->sql_freeresult($result);
diff --git a/phpBB/includes/auth/auth.php b/phpBB/phpbb/auth/auth.php
index 279959974d..279959974d 100644
--- a/phpBB/includes/auth/auth.php
+++ b/phpBB/phpbb/auth/auth.php
diff --git a/phpBB/includes/auth/index.htm b/phpBB/phpbb/auth/index.htm
index ee1f723a7d..ee1f723a7d 100644
--- a/phpBB/includes/auth/index.htm
+++ b/phpBB/phpbb/auth/index.htm
diff --git a/phpBB/includes/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php
index 5f6f2862b6..2e80436f78 100644
--- a/phpBB/includes/auth/provider/apache.php
+++ b/phpBB/phpbb/auth/provider/apache.php
@@ -20,7 +20,7 @@ if (!defined('IN_PHPBB'))
*
* @package auth
*/
-class phpbb_auth_provider_apache implements phpbb_auth_provider_interface
+class phpbb_auth_provider_apache extends phpbb_auth_provider_base
{
/**
* Apache Authentication Constructor
@@ -256,20 +256,4 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface
return false;
}
-
- /**
- * {@inheritdoc}
- */
- public function acp($new)
- {
- return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function logout($data, $new_session)
- {
- return;
- }
}
diff --git a/phpBB/phpbb/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php
new file mode 100644
index 0000000000..7eaf8bb2d3
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/base.php
@@ -0,0 +1,72 @@
+<?php
+/**
+*
+* @package auth
+* @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 authentication provider class that all other providers should implement
+*
+* @package auth
+*/
+abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function init()
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function autologin()
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function acp()
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_acp_template($new_config)
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function logout($data, $new_session)
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function validate_session($user)
+ {
+ return;
+ }
+}
diff --git a/phpBB/includes/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php
index 894041c9cf..0934c56d9b 100644
--- a/phpBB/includes/auth/provider/db.php
+++ b/phpBB/phpbb/auth/provider/db.php
@@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package auth
*/
-class phpbb_auth_provider_db implements phpbb_auth_provider_interface
+class phpbb_auth_provider_db extends phpbb_auth_provider_base
{
/**
@@ -48,14 +48,6 @@ class phpbb_auth_provider_db implements phpbb_auth_provider_interface
/**
* {@inheritdoc}
*/
- public function init()
- {
- return;
- }
-
- /**
- * {@inheritdoc}
- */
public function login($username, $password)
{
// Auth plugins get the password untrimmed.
@@ -302,36 +294,4 @@ class phpbb_auth_provider_db implements phpbb_auth_provider_interface
'user_row' => $row,
);
}
-
- /**
- * {@inheritdoc}
- */
- public function autologin()
- {
- return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function acp($new)
- {
- return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function logout($data, $new_session)
- {
- return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validate_session($user)
- {
- return;
- }
}
diff --git a/phpBB/includes/auth/provider/index.htm b/phpBB/phpbb/auth/provider/index.htm
index ee1f723a7d..ee1f723a7d 100644
--- a/phpBB/includes/auth/provider/index.htm
+++ b/phpBB/phpbb/auth/provider/index.htm
diff --git a/phpBB/includes/auth/provider/interface.php b/phpBB/phpbb/auth/provider/interface.php
index 2d1935f8f0..47043bc107 100644
--- a/phpBB/includes/auth/provider/interface.php
+++ b/phpBB/phpbb/auth/provider/interface.php
@@ -60,16 +60,28 @@ interface phpbb_auth_provider_interface
* This function is used to output any required fields in the authentication
* admin panel. It also defines any required configuration table fields.
*
- * @param array $new Contains the new configuration values that have
- * been set in acp_board.
* @return array|null Returns null if not implemented or an array of the
- * form:
+ * configuration fields of the provider.
+ */
+ public function acp();
+
+ /**
+ * This function updates the template with variables related to the acp
+ * options with whatever configuraton values are passed to it as an array.
+ * It then returns the name of the acp file related to this authentication
+ * provider.
+ * @param array $new_config Contains the new configuration values that
+ * have been set in acp_board.
+ * @return array|null Returns null if not implemented or an array with
+ * the template file name and an array of the vars
+ * that the template needs that must conform to the
+ * following example:
* array(
- * 'tpl' => string
- * 'config' => array
+ * 'TEMPLATE_FILE' => string,
+ * 'TEMPLATE_VARS' => array(...),
* )
*/
- public function acp($new);
+ public function get_acp_template($new_config);
/**
* Performs additional actions during logout.
diff --git a/phpBB/includes/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php
index f67c1e9247..0196529408 100644
--- a/phpBB/includes/auth/provider/ldap.php
+++ b/phpBB/phpbb/auth/provider/ldap.php
@@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package auth
*/
-class phpbb_auth_provider_ldap implements phpbb_auth_provider_interface
+class phpbb_auth_provider_ldap extends phpbb_auth_provider_base
{
/**
* LDAP Authentication Constructor
@@ -286,56 +286,32 @@ class phpbb_auth_provider_ldap implements phpbb_auth_provider_interface
/**
* {@inheritdoc}
*/
- public function autologin()
+
+ public function acp()
{
- return;
+ // These are fields required in the config table
+ return array(
+ 'ldap_server', 'ldap_port', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password',
+ );
}
/**
* {@inheritdoc}
*/
- public function acp($new)
+ public function get_acp_template($new_config)
{
- $tpl = '
-
- <dl>
- <dt><label for="ldap_server">' . $this->user->lang['LDAP_SERVER'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_SERVER_EXPLAIN'] . '</span></dt>
- <dd><input type="text" id="ldap_server" size="40" name="config[ldap_server]" value="' . $new['ldap_server'] . '" /></dd>
- </dl>
- <dl>
- <dt><label for="ldap_port">' . $this->user->lang['LDAP_PORT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_PORT_EXPLAIN'] . '</span></dt>
- <dd><input type="text" id="ldap_port" size="40" name="config[ldap_port]" value="' . $new['ldap_port'] . '" /></dd>
- </dl>
- <dl>
- <dt><label for="ldap_dn">' . $this->user->lang['LDAP_DN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_DN_EXPLAIN'] . '</span></dt>
- <dd><input type="text" id="ldap_dn" size="40" name="config[ldap_base_dn]" value="' . $new['ldap_base_dn'] . '" /></dd>
- </dl>
- <dl>
- <dt><label for="ldap_uid">' . $this->user->lang['LDAP_UID'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_UID_EXPLAIN'] . '</span></dt>
- <dd><input type="text" id="ldap_uid" size="40" name="config[ldap_uid]" value="' . $new['ldap_uid'] . '" /></dd>
- </dl>
- <dl>
- <dt><label for="ldap_user_filter">' . $this->user->lang['LDAP_USER_FILTER'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_USER_FILTER_EXPLAIN'] . '</span></dt>
- <dd><input type="text" id="ldap_user_filter" size="40" name="config[ldap_user_filter]" value="' . $new['ldap_user_filter'] . '" /></dd>
- </dl>
- <dl>
- <dt><label for="ldap_email">' . $this->user->lang['LDAP_EMAIL'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_EMAIL_EXPLAIN'] . '</span></dt>
- <dd><input type="email" id="ldap_email" size="40" name="config[ldap_email]" value="' . $new['ldap_email'] . '" /></dd>
- </dl>
- <dl>
- <dt><label for="ldap_user">' . $this->user->lang['LDAP_USER'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_USER_EXPLAIN'] . '</span></dt>
- <dd><input type="text" id="ldap_user" size="40" name="config[ldap_user]" value="' . $new['ldap_user'] . '" /></dd>
- </dl>
- <dl>
- <dt><label for="ldap_password">' . $this->user->lang['LDAP_PASSWORD'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_PASSWORD_EXPLAIN'] . '</span></dt>
- <dd><input type="password" id="ldap_password" size="40" name="config[ldap_password]" value="' . $new['ldap_password'] . '" autocomplete="off" /></dd>
- </dl>
- ';
-
- // These are fields required in the config table
return array(
- 'tpl' => $tpl,
- 'config' => array('ldap_server', 'ldap_port', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password')
+ 'TEMPLATE_FILE' => 'auth_provider_ldap.html',
+ 'TEMPLATE_VARS' => array(
+ 'AUTH_LDAP_DN' => $new_config['ldap_base_dn'],
+ 'AUTH_LDAP_EMAIL' => $new_config['ldap_email'],
+ 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'],
+ 'AUTH_LDAP_PORT' => $new_config['ldap_port'],
+ 'AUTH_LDAP_SERVER' => $new_config['ldap_server'],
+ 'AUTH_LDAP_UID' => $new_config['ldap_uid'],
+ 'AUTH_LDAP_USER' => $new_config['ldap_user'],
+ 'AUTH_LDAP_USER_FILTER' => $new_config['ldap_user_filter'],
+ ),
);
}
@@ -367,20 +343,4 @@ class phpbb_auth_provider_ldap implements phpbb_auth_provider_interface
{
return str_replace(array('*', '\\', '(', ')'), array('\\*', '\\\\', '\\(', '\\)'), $string);
}
-
- /**
- * {@inheritdoc}
- */
- public function logout($data, $new_session)
- {
- return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validate_session($user)
- {
- return;
- }
}
diff --git a/phpBB/includes/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php
index 29c58d4e62..29c58d4e62 100644
--- a/phpBB/includes/avatar/driver/driver.php
+++ b/phpBB/phpbb/avatar/driver/driver.php
diff --git a/phpBB/includes/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php
index d559da1c0d..d559da1c0d 100644
--- a/phpBB/includes/avatar/driver/gravatar.php
+++ b/phpBB/phpbb/avatar/driver/gravatar.php
diff --git a/phpBB/includes/avatar/driver/interface.php b/phpBB/phpbb/avatar/driver/interface.php
index 3d62969aef..3d62969aef 100644
--- a/phpBB/includes/avatar/driver/interface.php
+++ b/phpBB/phpbb/avatar/driver/interface.php
diff --git a/phpBB/includes/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php
index f4bcd4ce74..f4bcd4ce74 100644
--- a/phpBB/includes/avatar/driver/local.php
+++ b/phpBB/phpbb/avatar/driver/local.php
diff --git a/phpBB/includes/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php
index 7da58107a1..d629a490fd 100644
--- a/phpBB/includes/avatar/driver/remote.php
+++ b/phpBB/phpbb/avatar/driver/remote.php
@@ -93,7 +93,7 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
// Make sure getimagesize works...
if (function_exists('getimagesize'))
{
- if (($width <= 0 || $height <= 0) && (($image_data = getimagesize($url)) === false))
+ if (($width <= 0 || $height <= 0) && (($image_data = @getimagesize($url)) === false))
{
$error[] = 'UNABLE_GET_IMAGE_SIZE';
return false;
diff --git a/phpBB/includes/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index baf51f61c1..685ac4f349 100644
--- a/phpBB/includes/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -77,6 +77,32 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver
}
elseif (!empty($this->config['allow_avatar_remote_upload']) && !empty($url))
{
+ if (!preg_match('#^(http|https|ftp)://#i', $url))
+ {
+ $url = 'http://' . $url;
+ }
+
+ if (!function_exists('validate_data'))
+ {
+ require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
+ }
+
+ $validate_array = validate_data(
+ array(
+ 'url' => $url,
+ ),
+ array(
+ 'url' => array('string', true, 5, 255),
+ )
+ );
+
+ $error = array_merge($error, $validate_array);
+
+ if (!empty($error))
+ {
+ return false;
+ }
+
$file = $upload->remote_upload($url);
}
else
diff --git a/phpBB/includes/avatar/manager.php b/phpBB/phpbb/avatar/manager.php
index 58d994c3c0..58d994c3c0 100644
--- a/phpBB/includes/avatar/manager.php
+++ b/phpBB/phpbb/avatar/manager.php
diff --git a/phpBB/includes/cache/driver/apc.php b/phpBB/phpbb/cache/driver/apc.php
index 0516b669c8..0516b669c8 100644
--- a/phpBB/includes/cache/driver/apc.php
+++ b/phpBB/phpbb/cache/driver/apc.php
diff --git a/phpBB/includes/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php
index 32e04f813a..32e04f813a 100644
--- a/phpBB/includes/cache/driver/base.php
+++ b/phpBB/phpbb/cache/driver/base.php
diff --git a/phpBB/includes/cache/driver/eaccelerator.php b/phpBB/phpbb/cache/driver/eaccelerator.php
index 257b90c76e..257b90c76e 100644
--- a/phpBB/includes/cache/driver/eaccelerator.php
+++ b/phpBB/phpbb/cache/driver/eaccelerator.php
diff --git a/phpBB/includes/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php
index 85decbe3e8..85decbe3e8 100644
--- a/phpBB/includes/cache/driver/file.php
+++ b/phpBB/phpbb/cache/driver/file.php
diff --git a/phpBB/includes/cache/driver/interface.php b/phpBB/phpbb/cache/driver/interface.php
index 53f684d1c8..53f684d1c8 100644
--- a/phpBB/includes/cache/driver/interface.php
+++ b/phpBB/phpbb/cache/driver/interface.php
diff --git a/phpBB/includes/cache/driver/memcache.php b/phpBB/phpbb/cache/driver/memcache.php
index 3fd16b23b0..3fd16b23b0 100644
--- a/phpBB/includes/cache/driver/memcache.php
+++ b/phpBB/phpbb/cache/driver/memcache.php
diff --git a/phpBB/includes/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php
index f77a1df316..f77a1df316 100644
--- a/phpBB/includes/cache/driver/memory.php
+++ b/phpBB/phpbb/cache/driver/memory.php
diff --git a/phpBB/includes/cache/driver/null.php b/phpBB/phpbb/cache/driver/null.php
index 2fadc27ba3..2fadc27ba3 100644
--- a/phpBB/includes/cache/driver/null.php
+++ b/phpBB/phpbb/cache/driver/null.php
diff --git a/phpBB/includes/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php
index 960735b673..960735b673 100644
--- a/phpBB/includes/cache/driver/redis.php
+++ b/phpBB/phpbb/cache/driver/redis.php
diff --git a/phpBB/includes/cache/driver/wincache.php b/phpBB/phpbb/cache/driver/wincache.php
index 58f3b4a581..58f3b4a581 100644
--- a/phpBB/includes/cache/driver/wincache.php
+++ b/phpBB/phpbb/cache/driver/wincache.php
diff --git a/phpBB/includes/cache/driver/xcache.php b/phpBB/phpbb/cache/driver/xcache.php
index 06c5fafd97..06c5fafd97 100644
--- a/phpBB/includes/cache/driver/xcache.php
+++ b/phpBB/phpbb/cache/driver/xcache.php
diff --git a/phpBB/includes/cache/service.php b/phpBB/phpbb/cache/service.php
index 69c5e0fdd0..69c5e0fdd0 100644
--- a/phpBB/includes/cache/service.php
+++ b/phpBB/phpbb/cache/service.php
diff --git a/phpBB/includes/class_loader.php b/phpBB/phpbb/class_loader.php
index 02a2d584dc..02a2d584dc 100644
--- a/phpBB/includes/class_loader.php
+++ b/phpBB/phpbb/class_loader.php
diff --git a/phpBB/includes/config/config.php b/phpBB/phpbb/config/config.php
index 4b533dd55c..4b533dd55c 100644
--- a/phpBB/includes/config/config.php
+++ b/phpBB/phpbb/config/config.php
diff --git a/phpBB/includes/config/db.php b/phpBB/phpbb/config/db.php
index b18369a479..b18369a479 100644
--- a/phpBB/includes/config/db.php
+++ b/phpBB/phpbb/config/db.php
diff --git a/phpBB/includes/config/db_text.php b/phpBB/phpbb/config/db_text.php
index b365cb5c77..b365cb5c77 100644
--- a/phpBB/includes/config/db_text.php
+++ b/phpBB/phpbb/config/db_text.php
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
new file mode 100644
index 0000000000..4ad5f6793e
--- /dev/null
+++ b/phpBB/phpbb/content_visibility.php
@@ -0,0 +1,651 @@
+<?php
+/**
+*
+* @package phpbb
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* phpbb_visibility
+* Handle fetching and setting the visibility for topics and posts
+* @package phpbb
+*/
+class phpbb_content_visibility
+{
+ /**
+ * Database object
+ * @var phpbb_db_driver
+ */
+ protected $db;
+
+ /**
+ * User object
+ * @var phpbb_user
+ */
+ protected $user;
+
+ /**
+ * Auth object
+ * @var phpbb_auth
+ */
+ protected $auth;
+
+ /**
+ * phpBB root path
+ * @var string
+ */
+ protected $phpbb_root_path;
+
+ /**
+ * PHP Extension
+ * @var string
+ */
+ protected $php_ext;
+
+ /**
+ * Constructor
+ *
+ * @param phpbb_auth $auth Auth object
+ * @param phpbb_db_driver $db Database object
+ * @param phpbb_user $user User object
+ * @param string $phpbb_root_path Root path
+ * @param string $php_ext PHP Extension
+ * @return null
+ */
+ public function __construct(phpbb_auth $auth, phpbb_db_driver $db, phpbb_user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table)
+ {
+ $this->auth = $auth;
+ $this->db = $db;
+ $this->user = $user;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ $this->forums_table = $forums_table;
+ $this->posts_table = $posts_table;
+ $this->topics_table = $topics_table;
+ $this->users_table = $users_table;
+ }
+
+ /**
+ * Can the current logged-in user soft-delete posts?
+ *
+ * @param $forum_id int Forum ID whose permissions to check
+ * @param $poster_id int Poster ID of the post in question
+ * @param $post_locked bool Is the post locked?
+ * @return bool
+ */
+ public function can_soft_delete($forum_id, $poster_id, $post_locked)
+ {
+ if ($this->auth->acl_get('m_softdelete', $forum_id))
+ {
+ return true;
+ }
+ else if ($this->auth->acl_get('f_softdelete', $forum_id) && $poster_id == $this->user->data['user_id'] && !$post_locked)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Get the topics post count or the forums post/topic count based on permissions
+ *
+ * @param $mode string One of topic_posts, forum_posts or forum_topics
+ * @param $data array Array with the topic/forum data to calculate from
+ * @param $forum_id int The forum id is used for permission checks
+ * @return int Number of posts/topics the user can see in the topic/forum
+ */
+ public function get_count($mode, $data, $forum_id)
+ {
+ if (!$this->auth->acl_get('m_approve', $forum_id))
+ {
+ return (int) $data[$mode . '_approved'];
+ }
+
+ return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted'];
+ }
+
+ /**
+ * Create topic/post visibility SQL for a given forum ID
+ *
+ * Note: Read permissions are not checked.
+ *
+ * @param $mode string Either "topic" or "post"
+ * @param $forum_id int The forum id is used for permission checks
+ * @param $table_alias string Table alias to prefix in SQL queries
+ * @return string The appropriate combination SQL logic for topic/post_visibility
+ */
+ public function get_visibility_sql($mode, $forum_id, $table_alias = '')
+ {
+ if ($this->auth->acl_get('m_approve', $forum_id))
+ {
+ return '1 = 1';
+ }
+
+ return $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
+ }
+
+ /**
+ * Create topic/post visibility SQL for a set of forums
+ *
+ * Note: Read permissions are not checked. Forums without read permissions
+ * should not be in $forum_ids
+ *
+ * @param $mode string Either "topic" or "post"
+ * @param $forum_ids array Array of forum ids which the posts/topics are limited to
+ * @param $table_alias string Table alias to prefix in SQL queries
+ * @return string The appropriate combination SQL logic for topic/post_visibility
+ */
+ public function get_forums_visibility_sql($mode, $forum_ids = array(), $table_alias = '')
+ {
+ $where_sql = '(';
+
+ $approve_forums = array_intersect($forum_ids, array_keys($this->auth->acl_getf('m_approve', true)));
+
+ if (sizeof($approve_forums))
+ {
+ // Remove moderator forums from the rest
+ $forum_ids = array_diff($forum_ids, $approve_forums);
+
+ if (!sizeof($forum_ids))
+ {
+ // The user can see all posts/topics in all specified forums
+ return $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums);
+ }
+ else
+ {
+ // Moderator can view all posts/topics in some forums
+ $where_sql .= $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums) . ' OR ';
+ }
+ }
+ else
+ {
+ // The user is just a normal user
+ return $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . '
+ AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true);
+ }
+
+ $where_sql .= '(' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . '
+ AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids) . '))';
+
+ return $where_sql;
+ }
+
+ /**
+ * Create topic/post visibility SQL for all forums on the board
+ *
+ * Note: Read permissions are not checked. Forums without read permissions
+ * should be in $exclude_forum_ids
+ *
+ * @param $mode string Either "topic" or "post"
+ * @param $exclude_forum_ids array Array of forum ids which are excluded
+ * @param $table_alias string Table alias to prefix in SQL queries
+ * @return string The appropriate combination SQL logic for topic/post_visibility
+ */
+ public function get_global_visibility_sql($mode, $exclude_forum_ids = array(), $table_alias = '')
+ {
+ $where_sqls = array();
+
+ $approve_forums = array_diff(array_keys($this->auth->acl_getf('m_approve', true)), $exclude_forum_ids);
+
+ if (sizeof($exclude_forum_ids))
+ {
+ $where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true) . '
+ AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')';
+ }
+ else
+ {
+ $where_sqls[] = $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
+ }
+
+ if (sizeof($approve_forums))
+ {
+ $where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums);
+ return '(' . implode(' OR ', $where_sqls) . ')';
+ }
+
+ // There is only one element, so we just return that one
+ return $where_sqls[0];
+ }
+
+ /**
+ * Change visibility status of one post or all posts of a topic
+ *
+ * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED}
+ * @param $post_id mixed Post ID or array of post IDs to act on,
+ * if it is empty, all posts of topic_id will be modified
+ * @param $topic_id int Topic where $post_id is found
+ * @param $forum_id int Forum where $topic_id is found
+ * @param $user_id int User performing the action
+ * @param $time int Timestamp when the action is performed
+ * @param $reason string Reason why the visibilty was changed.
+ * @param $is_starter bool Is this the first post of the topic changed?
+ * @param $is_latest bool Is this the last post of the topic changed?
+ * @param $limit_visibility mixed Limit updating per topic_id to a certain visibility
+ * @param $limit_delete_time mixed Limit updating per topic_id to a certain deletion time
+ * @return array Changed post data, empty array if an error occured.
+ */
+ public function set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest, $limit_visibility = false, $limit_delete_time = false)
+ {
+ if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED)))
+ {
+ return array();
+ }
+
+ if ($post_id)
+ {
+ if (is_array($post_id))
+ {
+ $where_sql = $this->db->sql_in_set('post_id', array_map('intval', $post_id));
+ }
+ else
+ {
+ $where_sql = 'post_id = ' . (int) $post_id;
+ }
+ $where_sql .= ' AND topic_id = ' . (int) $topic_id;
+ }
+ else
+ {
+ $where_sql = 'topic_id = ' . (int) $topic_id;
+
+ // Limit the posts to a certain visibility and deletion time
+ // This allows us to only restore posts, that were approved
+ // when the topic got soft deleted. So previous soft deleted
+ // and unapproved posts are still soft deleted/unapproved
+ if ($limit_visibility !== false)
+ {
+ $where_sql .= ' AND post_visibility = ' . (int) $limit_visibility;
+ }
+
+ if ($limit_delete_time !== false)
+ {
+ $where_sql .= ' AND post_delete_time = ' . (int) $limit_delete_time;
+ }
+ }
+
+ $sql = 'SELECT poster_id, post_id, post_postcount, post_visibility
+ FROM ' . $this->posts_table . '
+ WHERE ' . $where_sql;
+ $result = $this->db->sql_query($sql);
+
+ $post_ids = $poster_postcounts = $postcounts = $postcount_visibility = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $post_ids[] = (int) $row['post_id'];
+
+ if ($row['post_visibility'] != $visibility)
+ {
+ if ($row['post_postcount'] && !isset($poster_postcounts[(int) $row['poster_id']]))
+ {
+ $poster_postcounts[(int) $row['poster_id']] = 1;
+ }
+ else if ($row['post_postcount'])
+ {
+ $poster_postcounts[(int) $row['poster_id']]++;
+ }
+
+ if (!isset($postcount_visibility[$row['post_visibility']]))
+ {
+ $postcount_visibility[$row['post_visibility']] = 1;
+ }
+ else
+ {
+ $postcount_visibility[$row['post_visibility']]++;
+ }
+ }
+ }
+ $this->db->sql_freeresult($result);
+
+ if (empty($post_ids))
+ {
+ return array();
+ }
+
+ $data = array(
+ 'post_visibility' => (int) $visibility,
+ 'post_delete_user' => (int) $user_id,
+ 'post_delete_time' => ((int) $time) ?: time(),
+ 'post_delete_reason' => truncate_string($reason, 255, 255, false),
+ );
+
+ $sql = 'UPDATE ' . $this->posts_table . '
+ SET ' . $this->db->sql_build_array('UPDATE', $data) . '
+ WHERE ' . $this->db->sql_in_set('post_id', $post_ids);
+ $this->db->sql_query($sql);
+
+ // Group the authors by post count, to reduce the number of queries
+ foreach ($poster_postcounts as $poster_id => $num_posts)
+ {
+ $postcounts[$num_posts][] = $poster_id;
+ }
+
+ // Update users postcounts
+ foreach ($postcounts as $num_posts => $poster_ids)
+ {
+ if ($visibility == ITEM_DELETED)
+ {
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = 0
+ WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . '
+ AND user_posts < ' . $num_posts;
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = user_posts - ' . $num_posts . '
+ WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . '
+ AND user_posts >= ' . $num_posts;
+ $this->db->sql_query($sql);
+ }
+ else
+ {
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = user_posts + ' . $num_posts . '
+ WHERE ' . $this->db->sql_in_set('user_id', $poster_ids);
+ $this->db->sql_query($sql);
+ }
+ }
+
+ $update_topic_postcount = true;
+
+ // Sync the first/last topic information if needed
+ if (!$is_starter && $is_latest)
+ {
+ // update_post_information can only update the last post info ...
+ if ($topic_id)
+ {
+ update_post_information('topic', $topic_id, false);
+ }
+ if ($forum_id)
+ {
+ update_post_information('forum', $forum_id, false);
+ }
+ }
+ else if ($is_starter && $topic_id)
+ {
+ if (!function_exists('sync'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
+ }
+
+ // ... so we need to use sync, if the first post is changed.
+ // The forum is resynced recursive by sync() itself.
+ sync('topic', 'topic_id', $topic_id, true);
+
+ // sync recalculates the topic replies and forum posts by itself, so we don't do that.
+ $update_topic_postcount = false;
+ }
+
+ // Update the topic's reply count and the forum's post count
+ if ($update_topic_postcount)
+ {
+ $cur_posts = $cur_unapproved_posts = $cur_softdeleted_posts = 0;
+ foreach ($postcount_visibility as $post_visibility => $visibility_posts)
+ {
+ // We need to substract the posts from the counters ...
+ if ($post_visibility == ITEM_APPROVED)
+ {
+ $cur_posts += $visibility_posts;
+ }
+ else if ($post_visibility == ITEM_UNAPPROVED)
+ {
+ $cur_unapproved_posts += $visibility_posts;
+ }
+ else if ($post_visibility == ITEM_DELETED)
+ {
+ $cur_softdeleted_posts += $visibility_posts;
+ }
+ }
+
+ $sql_ary = array();
+ if ($visibility == ITEM_DELETED)
+ {
+ if ($cur_posts)
+ {
+ $sql_ary['posts_approved'] = ' - ' . $cur_posts;
+ }
+ if ($cur_unapproved_posts)
+ {
+ $sql_ary['posts_unapproved'] = ' - ' . $cur_unapproved_posts;
+ }
+ if ($cur_posts + $cur_unapproved_posts)
+ {
+ $sql_ary['posts_softdeleted'] = ' + ' . ($cur_posts + $cur_unapproved_posts);
+ }
+ }
+ else
+ {
+ if ($cur_unapproved_posts)
+ {
+ $sql_ary['posts_unapproved'] = ' - ' . $cur_unapproved_posts;
+ }
+ if ($cur_softdeleted_posts)
+ {
+ $sql_ary['posts_softdeleted'] = ' - ' . $cur_softdeleted_posts;
+ }
+ if ($cur_softdeleted_posts + $cur_unapproved_posts)
+ {
+ $sql_ary['posts_approved'] = ' + ' . ($cur_softdeleted_posts + $cur_unapproved_posts);
+ }
+ }
+
+ if (sizeof($sql_ary))
+ {
+ $topic_sql = $forum_sql = array();
+
+ foreach ($sql_ary as $field => $value_change)
+ {
+ $topic_sql[] = 'topic_' . $field . ' = topic_' . $field . $value_change;
+ $forum_sql[] = 'forum_' . $field . ' = forum_' . $field . $value_change;
+ }
+
+ // Update the number for replies and posts
+ $sql = 'UPDATE ' . $this->topics_table . '
+ SET ' . implode(', ', $topic_sql) . '
+ WHERE topic_id = ' . (int) $topic_id;
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . $this->forums_table . '
+ SET ' . implode(', ', $forum_sql) . '
+ WHERE forum_id = ' . (int) $forum_id;
+ $this->db->sql_query($sql);
+ }
+ }
+
+ return $data;
+ }
+
+ /**
+ * Set topic visibility
+ *
+ * Allows approving (which is akin to undeleting/restore) or soft deleting an entire topic.
+ * Calls set_post_visibility as needed.
+ *
+ * Note: By default, when a soft deleted topic is restored. Only posts that
+ * were approved at the time of soft deleting, are being restored.
+ * Same applies to soft deleting. Only approved posts will be marked
+ * as soft deleted.
+ * If you want to update all posts, use the force option.
+ *
+ * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED}
+ * @param $topic_id mixed Topic ID to act on
+ * @param $forum_id int Forum where $topic_id is found
+ * @param $user_id int User performing the action
+ * @param $time int Timestamp when the action is performed
+ * @param $reason string Reason why the visibilty was changed.
+ * @param $force_update_all bool Force to update all posts within the topic
+ * @return array Changed topic data, empty array if an error occured.
+ */
+ public function set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all = false)
+ {
+ if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED)))
+ {
+ return array();
+ }
+
+ if (!$force_update_all)
+ {
+ $sql = 'SELECT topic_visibility, topic_delete_time
+ FROM ' . $this->topics_table . '
+ WHERE topic_id = ' . (int) $topic_id;
+ $result = $this->db->sql_query($sql);
+ $original_topic_data = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$original_topic_data)
+ {
+ // The topic does not exist...
+ return array();
+ }
+ }
+
+ // Note, we do not set a reason for the posts, just for the topic
+ $data = array(
+ 'topic_visibility' => (int) $visibility,
+ 'topic_delete_user' => (int) $user_id,
+ 'topic_delete_time' => ((int) $time) ?: time(),
+ 'topic_delete_reason' => truncate_string($reason, 255, 255, false),
+ );
+
+ $sql = 'UPDATE ' . $this->topics_table . '
+ SET ' . $this->db->sql_build_array('UPDATE', $data) . '
+ WHERE topic_id = ' . (int) $topic_id;
+ $this->db->sql_query($sql);
+
+ if (!$this->db->sql_affectedrows())
+ {
+ return array();
+ }
+
+ if (!$force_update_all && $original_topic_data['topic_delete_time'] && $original_topic_data['topic_visibility'] == ITEM_DELETED && $visibility == ITEM_APPROVED)
+ {
+ // If we're restoring a topic we only restore posts, that were soft deleted through the topic soft deletion.
+ self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility'], $original_topic_data['topic_delete_time']);
+ }
+ else if (!$force_update_all && $original_topic_data['topic_visibility'] == ITEM_APPROVED && $visibility == ITEM_DELETED)
+ {
+ // If we're soft deleting a topic we only approved posts are soft deleted.
+ self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility']);
+ }
+ else
+ {
+ self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true);
+ }
+
+ return $data;
+ }
+
+ /**
+ * Add post to topic and forum statistics
+ *
+ * @param $data array Contains information from the topics table about given topic
+ * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @return void
+ */
+ public function add_post_to_statistic($data, &$sql_data)
+ {
+ $sql_data[$this->topics_table] = (($sql_data[$this->topics_table]) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved + 1';
+
+ $sql_data[$this->forums_table] = (($sql_data[$this->forums_table]) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved + 1';
+
+ if ($data['post_postcount'])
+ {
+ $sql_data[$this->users_table] = (($sql_data[$this->users_table]) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts + 1';
+ }
+
+ set_config_count('num_posts', 1, true);
+ }
+
+ /**
+ * Remove post from topic and forum statistics
+ *
+ * @param $data array Contains information from the topics table about given topic
+ * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @return void
+ */
+ public function remove_post_from_statistic($data, &$sql_data)
+ {
+ $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1';
+ $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1';
+
+ if ($data['post_postcount'])
+ {
+ $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1';
+ }
+
+ set_config_count('num_posts', -1, true);
+ }
+
+ /**
+ * Remove topic from forum statistics
+ *
+ * @param $topic_id int The topic to act on
+ * @param $forum_id int Forum where the topic is found
+ * @param $topic_row array Contains information from the topic, may be empty at call time
+ * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @return void
+ */
+ public function remove_topic_from_statistic($topic_id, $forum_id, &$topic_row, &$sql_data)
+ {
+ // Do we need to grab some topic informations?
+ if (!sizeof($topic_row))
+ {
+ $sql = 'SELECT topic_type, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility
+ FROM ' . $this->topics_table . '
+ WHERE topic_id = ' . (int) $topic_id;
+ $result = $this->db->sql_query($sql);
+ $topic_row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+ }
+
+ // If this is an edited topic or the first post the topic gets completely disapproved later on...
+ $sql_data[$this->forums_table] = (($sql_data[$this->forums_table]) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_topics_approved = forum_topics_approved - 1';
+ $sql_data[$this->forums_table] .= ', forum_posts_approved = forum_posts_approved - ' . $topic_row['topic_posts_approved'];
+ $sql_data[$this->forums_table] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved'];
+ $sql_data[$this->forums_table] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted'];
+
+ set_config_count('num_topics', -1, true);
+ set_config_count('num_posts', $topic_row['topic_posts_approved'] * (-1), true);
+
+ // Get user post count information
+ $sql = 'SELECT poster_id, COUNT(post_id) AS num_posts
+ FROM ' . $this->posts_table . '
+ WHERE topic_id = ' . (int) $topic_id . '
+ AND post_postcount = 1
+ AND post_visibility = ' . ITEM_APPROVED . '
+ GROUP BY poster_id';
+ $result = $this->db->sql_query($sql);
+
+ $postcounts = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $postcounts[(int) $row['num_posts']][] = (int) $row['poster_id'];
+ }
+ $this->db->sql_freeresult($result);
+
+ // Decrement users post count
+ foreach ($postcounts as $num_posts => $poster_ids)
+ {
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = 0
+ WHERE user_posts < ' . $num_posts . '
+ AND ' . $this->db->sql_in_set('user_id', $poster_ids);
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . $this->users_table . '
+ SET user_posts = user_posts - ' . $num_posts . '
+ WHERE user_posts >= ' . $num_posts . '
+ AND ' . $this->db->sql_in_set('user_id', $poster_ids);
+ $this->db->sql_query($sql);
+ }
+ }
+}
diff --git a/phpBB/includes/controller/exception.php b/phpBB/phpbb/controller/exception.php
index faa8b6b584..faa8b6b584 100644
--- a/phpBB/includes/controller/exception.php
+++ b/phpBB/phpbb/controller/exception.php
diff --git a/phpBB/includes/controller/helper.php b/phpBB/phpbb/controller/helper.php
index 74410ddfd1..74410ddfd1 100644
--- a/phpBB/includes/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
diff --git a/phpBB/includes/controller/provider.php b/phpBB/phpbb/controller/provider.php
index b2a5b9f6b2..b2a5b9f6b2 100644
--- a/phpBB/includes/controller/provider.php
+++ b/phpBB/phpbb/controller/provider.php
diff --git a/phpBB/includes/controller/resolver.php b/phpBB/phpbb/controller/resolver.php
index 95dfc8da8e..95dfc8da8e 100644
--- a/phpBB/includes/controller/resolver.php
+++ b/phpBB/phpbb/controller/resolver.php
diff --git a/phpBB/includes/cron/manager.php b/phpBB/phpbb/cron/manager.php
index 84c9650830..84c9650830 100644
--- a/phpBB/includes/cron/manager.php
+++ b/phpBB/phpbb/cron/manager.php
diff --git a/phpBB/includes/cron/task/base.php b/phpBB/phpbb/cron/task/base.php
index 94a2f267b4..94a2f267b4 100644
--- a/phpBB/includes/cron/task/base.php
+++ b/phpBB/phpbb/cron/task/base.php
diff --git a/phpBB/includes/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php
index 2c5d38cec0..2c5d38cec0 100644
--- a/phpBB/includes/cron/task/core/prune_all_forums.php
+++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php
diff --git a/phpBB/includes/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php
index e3c497f072..e3c497f072 100644
--- a/phpBB/includes/cron/task/core/prune_forum.php
+++ b/phpBB/phpbb/cron/task/core/prune_forum.php
diff --git a/phpBB/includes/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php
index 732f9c6bea..732f9c6bea 100644
--- a/phpBB/includes/cron/task/core/queue.php
+++ b/phpBB/phpbb/cron/task/core/queue.php
diff --git a/phpBB/includes/cron/task/core/tidy_cache.php b/phpBB/phpbb/cron/task/core/tidy_cache.php
index 16a45dae7c..16a45dae7c 100644
--- a/phpBB/includes/cron/task/core/tidy_cache.php
+++ b/phpBB/phpbb/cron/task/core/tidy_cache.php
diff --git a/phpBB/includes/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php
index b882e7b500..b882e7b500 100644
--- a/phpBB/includes/cron/task/core/tidy_database.php
+++ b/phpBB/phpbb/cron/task/core/tidy_database.php
diff --git a/phpBB/includes/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php
index 3ec25aa021..a3d5b7dbd2 100644
--- a/phpBB/includes/cron/task/core/tidy_search.php
+++ b/phpBB/phpbb/cron/task/core/tidy_search.php
@@ -61,11 +61,6 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
// Select the search method
$search_type = basename($this->config['search_type']);
- if (!class_exists($search_type))
- {
- include($this->phpbb_root_path . "includes/search/$search_type." . $this->php_ext);
- }
-
// We do some additional checks in the module to ensure it can actually be utilised
$error = false;
$search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user);
@@ -90,7 +85,7 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
// Select the search method
$search_type = basename($this->config['search_type']);
- return file_exists($this->phpbb_root_path . 'includes/search/' . $search_type . '.' . $this->php_ext);
+ return class_exists($search_type);
}
/**
diff --git a/phpBB/includes/cron/task/core/tidy_sessions.php b/phpBB/phpbb/cron/task/core/tidy_sessions.php
index 95f55235c9..95f55235c9 100644
--- a/phpBB/includes/cron/task/core/tidy_sessions.php
+++ b/phpBB/phpbb/cron/task/core/tidy_sessions.php
diff --git a/phpBB/includes/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php
index 2a7798e56e..2a7798e56e 100644
--- a/phpBB/includes/cron/task/core/tidy_warnings.php
+++ b/phpBB/phpbb/cron/task/core/tidy_warnings.php
diff --git a/phpBB/includes/cron/task/parametrized.php b/phpBB/phpbb/cron/task/parametrized.php
index 5f0e46eafc..5f0e46eafc 100644
--- a/phpBB/includes/cron/task/parametrized.php
+++ b/phpBB/phpbb/cron/task/parametrized.php
diff --git a/phpBB/includes/cron/task/task.php b/phpBB/phpbb/cron/task/task.php
index 2d585df96d..2d585df96d 100644
--- a/phpBB/includes/cron/task/task.php
+++ b/phpBB/phpbb/cron/task/task.php
diff --git a/phpBB/includes/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php
index 386fb5b383..386fb5b383 100644
--- a/phpBB/includes/cron/task/wrapper.php
+++ b/phpBB/phpbb/cron/task/wrapper.php
diff --git a/phpBB/includes/datetime.php b/phpBB/phpbb/datetime.php
index 3c6d4971b9..3c6d4971b9 100644
--- a/phpBB/includes/datetime.php
+++ b/phpBB/phpbb/datetime.php
diff --git a/phpBB/includes/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php
index b915ee081b..08c966c07a 100644
--- a/phpBB/includes/db/driver/driver.php
+++ b/phpBB/phpbb/db/driver/driver.php
@@ -878,7 +878,7 @@ class phpbb_db_driver
</div>
</div>
<div id="page-footer">
- Powered by <a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group
+ Powered by <a href="https://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group
</div>
</div>
</body>
diff --git a/phpBB/includes/db/driver/firebird.php b/phpBB/phpbb/db/driver/firebird.php
index 787c28b812..787c28b812 100644
--- a/phpBB/includes/db/driver/firebird.php
+++ b/phpBB/phpbb/db/driver/firebird.php
diff --git a/phpBB/includes/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php
index 89c2c2351b..89c2c2351b 100644
--- a/phpBB/includes/db/driver/mssql.php
+++ b/phpBB/phpbb/db/driver/mssql.php
diff --git a/phpBB/includes/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php
index 56c111c871..56c111c871 100644
--- a/phpBB/includes/db/driver/mssql_base.php
+++ b/phpBB/phpbb/db/driver/mssql_base.php
diff --git a/phpBB/includes/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php
index a1d1a5d5dd..a1d1a5d5dd 100644
--- a/phpBB/includes/db/driver/mssql_odbc.php
+++ b/phpBB/phpbb/db/driver/mssql_odbc.php
diff --git a/phpBB/includes/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php
index 28fc88298a..28fc88298a 100644
--- a/phpBB/includes/db/driver/mssqlnative.php
+++ b/phpBB/phpbb/db/driver/mssqlnative.php
diff --git a/phpBB/includes/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php
index f3744ac09d..f3744ac09d 100644
--- a/phpBB/includes/db/driver/mysql.php
+++ b/phpBB/phpbb/db/driver/mysql.php
diff --git a/phpBB/includes/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php
index ba44ea61aa..ba44ea61aa 100644
--- a/phpBB/includes/db/driver/mysql_base.php
+++ b/phpBB/phpbb/db/driver/mysql_base.php
diff --git a/phpBB/includes/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php
index 0f7a73ee6e..0f7a73ee6e 100644
--- a/phpBB/includes/db/driver/mysqli.php
+++ b/phpBB/phpbb/db/driver/mysqli.php
diff --git a/phpBB/includes/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php
index e21e07055d..e21e07055d 100644
--- a/phpBB/includes/db/driver/oracle.php
+++ b/phpBB/phpbb/db/driver/oracle.php
diff --git a/phpBB/includes/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php
index 14854d179d..14854d179d 100644
--- a/phpBB/includes/db/driver/postgres.php
+++ b/phpBB/phpbb/db/driver/postgres.php
diff --git a/phpBB/includes/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php
index 7188f0daa2..7188f0daa2 100644
--- a/phpBB/includes/db/driver/sqlite.php
+++ b/phpBB/phpbb/db/driver/sqlite.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1.php
index c996a0138a..c996a0138a 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_10.php b/phpBB/phpbb/db/migration/data/30x/3_0_10.php
index 122f93d6b4..122f93d6b4 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_10.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_10.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php
index 0ed05812dc..0ed05812dc 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_10_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php
index b14b3b00aa..b14b3b00aa 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_10_rc2.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php
index 473057d65d..473057d65d 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_10_rc3.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_11.php b/phpBB/phpbb/db/migration/data/30x/3_0_11.php
index e063c699cc..e063c699cc 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_11.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_11.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php
index dddfc0e0e7..dddfc0e0e7 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_11_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php
index fac8523e8c..fac8523e8c 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_11_rc2.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php
index 6a31a51201..6a31a51201 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_12_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php
index 562ccf077c..562ccf077c 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_1_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2.php
index eed5acef82..eed5acef82 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_2.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_2.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php
index a960e90765..a960e90765 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_2_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php
index 8917dfea77..8917dfea77 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_2_rc2.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_3.php b/phpBB/phpbb/db/migration/data/30x/3_0_3.php
index 8984cf7b76..8984cf7b76 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_3.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_3.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php
index 4b102e1a2e..4b102e1a2e 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_3_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_4.php b/phpBB/phpbb/db/migration/data/30x/3_0_4.php
index 9a0c132e78..9a0c132e78 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_4.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_4.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php
index 8ad75a557b..8ad75a557b 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_4_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_5.php b/phpBB/phpbb/db/migration/data/30x/3_0_5.php
index 16d2dee457..16d2dee457 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_5.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_5.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php
index ea17cc1e31..ea17cc1e31 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_5_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php
index 8538347b1a..8538347b1a 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_5_rc1part2.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_6.php b/phpBB/phpbb/db/migration/data/30x/3_0_6.php
index bb651dc7cd..bb651dc7cd 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_6.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_6.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php
index 38c282ebf0..38c282ebf0 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_6_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php
index a939dbd489..a939dbd489 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_6_rc2.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php
index b3f09d8ab8..b3f09d8ab8 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_6_rc3.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php
index fc2923f99b..fc2923f99b 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_6_rc4.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_7.php b/phpBB/phpbb/db/migration/data/30x/3_0_7.php
index 9ff2e9e4ab..9ff2e9e4ab 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_7.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_7.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php
index c9cc9d19ac..c9cc9d19ac 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_7_pl1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php
index ffebf66f2d..ffebf66f2d 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_7_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php
index 55bc2bc679..55bc2bc679 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_7_rc2.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_8.php b/phpBB/phpbb/db/migration/data/30x/3_0_8.php
index 8998ef9627..8998ef9627 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_8.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_8.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php
index aeff35333e..aeff35333e 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_8_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_9.php b/phpBB/phpbb/db/migration/data/30x/3_0_9.php
index d5269ea6f0..d5269ea6f0 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_9.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_9.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php
index 1f8622798e..4c345b429b 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_9_rc1.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php
@@ -27,8 +27,8 @@ class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration
'COLUMNS' => array(
// this column was removed from the database updater
// after 3.0.9-RC3 was released. It might still exist
- // in 3.0.9-RCX installations and has to be dropped in
- // 3.0.12 after the db_tools class is capable of properly
+ // in 3.0.9-RCX installations and has to be dropped as
+ // soon as the db_tools class is capable of properly
// removing a primary key.
// 'attempt_id' => array('UINT', NULL, 'auto_increment'),
'attempt_ip' => array('VCHAR:40', ''),
diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php
index c0e662aa45..c0e662aa45 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_9_rc2.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php
index d6d1f14b2e..d6d1f14b2e 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_9_rc3.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php
diff --git a/phpBB/includes/db/migration/data/30x/3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php
index e673249343..e673249343 100644
--- a/phpBB/includes/db/migration/data/30x/3_0_9_rc4.php
+++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php
diff --git a/phpBB/includes/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php
index f324b8880d..f324b8880d 100644
--- a/phpBB/includes/db/migration/data/30x/local_url_bbcode.php
+++ b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php
diff --git a/phpBB/includes/db/migration/data/310/avatars.php b/phpBB/phpbb/db/migration/data/310/avatars.php
index 79547337f7..79547337f7 100644
--- a/phpBB/includes/db/migration/data/310/avatars.php
+++ b/phpBB/phpbb/db/migration/data/310/avatars.php
diff --git a/phpBB/includes/db/migration/data/310/boardindex.php b/phpBB/phpbb/db/migration/data/310/boardindex.php
index 965e32c15c..965e32c15c 100644
--- a/phpBB/includes/db/migration/data/310/boardindex.php
+++ b/phpBB/phpbb/db/migration/data/310/boardindex.php
diff --git a/phpBB/includes/db/migration/data/310/config_db_text.php b/phpBB/phpbb/db/migration/data/310/config_db_text.php
index 89f211adda..89f211adda 100644
--- a/phpBB/includes/db/migration/data/310/config_db_text.php
+++ b/phpBB/phpbb/db/migration/data/310/config_db_text.php
diff --git a/phpBB/includes/db/migration/data/310/dev.php b/phpBB/phpbb/db/migration/data/310/dev.php
index 13b36bbf30..0fc2950987 100644
--- a/phpBB/includes/db/migration/data/310/dev.php
+++ b/phpBB/phpbb/db/migration/data/310/dev.php
@@ -82,7 +82,10 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration
public function update_data()
{
return array(
- array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])),
+ array('if', array(
+ (strpos('phpbb_search_', $this->config['search_type']) !== 0),
+ array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])),
+ )),
array('config.add', array('fulltext_postgres_ts_name', 'simple')),
array('config.add', array('fulltext_postgres_min_word_len', 4)),
diff --git a/phpBB/includes/db/migration/data/310/extensions.php b/phpBB/phpbb/db/migration/data/310/extensions.php
index 6a9caa1cfc..6a9caa1cfc 100644
--- a/phpBB/includes/db/migration/data/310/extensions.php
+++ b/phpBB/phpbb/db/migration/data/310/extensions.php
diff --git a/phpBB/includes/db/migration/data/310/forgot_password.php b/phpBB/phpbb/db/migration/data/310/forgot_password.php
index a553e51f35..a553e51f35 100644
--- a/phpBB/includes/db/migration/data/310/forgot_password.php
+++ b/phpBB/phpbb/db/migration/data/310/forgot_password.php
diff --git a/phpBB/includes/db/migration/data/310/jquery_update.php b/phpBB/phpbb/db/migration/data/310/jquery_update.php
index dc49f74fcb..dc49f74fcb 100644
--- a/phpBB/includes/db/migration/data/310/jquery_update.php
+++ b/phpBB/phpbb/db/migration/data/310/jquery_update.php
diff --git a/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php
new file mode 100644
index 0000000000..d994d7ec5f
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php
@@ -0,0 +1,118 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_db_migration
+{
+ static public function depends_on()
+ {
+ return array('phpbb_db_migration_data_310_notifications_schema_fix');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(array($this, 'convert_notifications'))),
+ );
+ }
+
+ public function convert_notifications()
+ {
+ $insert_table = $this->table_prefix . 'user_notifications';
+ $insert_buffer = new phpbb_db_sql_insert_buffer($this->db, $insert_table);
+
+ $this->perform_conversion($insert_buffer, $insert_table);
+ }
+
+ /**
+ * Perform the conversion (separate for testability)
+ *
+ * @param phpbb_db_sql_insert_buffer $insert_buffer
+ * @param string $insert_table
+ */
+ public function perform_conversion(phpbb_db_sql_insert_buffer $insert_buffer, $insert_table)
+ {
+ $sql = 'DELETE FROM ' . $insert_table;
+ $this->db->sql_query($sql);
+
+ $sql = 'SELECT user_id, user_notify_type, user_notify_pm
+ FROM ' . USERS_TABLE;
+ $result = $this->db->sql_query($sql);
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $notification_methods = array();
+
+ // In-board notification
+ $notification_methods[] = '';
+
+ if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH)
+ {
+ $notification_methods[] = 'email';
+ }
+
+ if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH)
+ {
+ $notification_methods[] = 'jabber';
+ }
+
+ // Notifications for posts
+ foreach (array('post', 'topic') as $item_type)
+ {
+ $this->add_method_rows(
+ $insert_buffer,
+ $item_type,
+ 0,
+ $row['user_id'],
+ $notification_methods
+ );
+ }
+
+ if ($row['user_notify_pm'])
+ {
+ // Notifications for private messages
+ // User either gets all methods or no method
+ $this->add_method_rows(
+ $insert_buffer,
+ 'pm',
+ 0,
+ $row['user_id'],
+ $notification_methods
+ );
+ }
+ }
+ $this->db->sql_freeresult($result);
+
+ $insert_buffer->flush();
+ }
+
+ /**
+ * Insert method rows to DB
+ *
+ * @param phpbb_db_sql_insert_buffer $insert_buffer
+ * @param string $item_type
+ * @param int $item_id
+ * @param int $user_id
+ * @param string $methods
+ */
+ protected function add_method_rows(phpbb_db_sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods)
+ {
+ $row_base = array(
+ 'item_type' => $item_type,
+ 'item_id' => (int) $item_id,
+ 'user_id' => (int) $user_id,
+ 'notify' => 1
+ );
+
+ foreach ($methods as $method)
+ {
+ $row_base['method'] = $method;
+ $insert_buffer->insert($row_base);
+ }
+ }
+}
diff --git a/phpBB/includes/db/migration/data/310/notifications.php b/phpBB/phpbb/db/migration/data/310/notifications.php
index 82bfd4cb2d..17c939d95a 100644
--- a/phpBB/includes/db/migration/data/310/notifications.php
+++ b/phpBB/phpbb/db/migration/data/310/notifications.php
@@ -91,70 +91,6 @@ class phpbb_db_migration_data_310_notifications extends phpbb_db_migration
),
)),
array('config.add', array('load_notifications', 1)),
- array('custom', array(array($this, 'convert_notifications'))),
);
}
-
- public function convert_notifications()
- {
- $convert_notifications = array(
- array(
- 'check' => ($this->config['allow_topic_notify']),
- 'item_type' => 'post',
- ),
- array(
- 'check' => ($this->config['allow_forum_notify']),
- 'item_type' => 'topic',
- ),
- array(
- 'check' => ($this->config['allow_bookmarks']),
- 'item_type' => 'bookmark',
- ),
- array(
- 'check' => ($this->config['allow_privmsg']),
- 'item_type' => 'pm',
- ),
- );
-
- foreach ($convert_notifications as $convert_data)
- {
- if ($convert_data['check'])
- {
- $sql = 'SELECT user_id, user_notify_type
- FROM ' . USERS_TABLE . '
- WHERE user_notify = 1';
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- $this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array(
- 'item_type' => $convert_data['item_type'],
- 'item_id' => 0,
- 'user_id' => $row['user_id'],
- 'method' => '',
- )));
-
- if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH)
- {
- $this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array(
- 'item_type' => $convert_data['item_type'],
- 'item_id' => 0,
- 'user_id' => $row['user_id'],
- 'method' => 'email',
- )));
- }
-
- if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH)
- {
- $this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array(
- 'item_type' => $convert_data['item_type'],
- 'item_id' => 0,
- 'user_id' => $row['user_id'],
- 'method' => 'jabber',
- )));
- }
- }
- $this->db->sql_freeresult($result);
- }
- }
- }
}
diff --git a/phpBB/includes/db/migration/data/310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php
index 27e63e10d0..27e63e10d0 100644
--- a/phpBB/includes/db/migration/data/310/notifications_schema_fix.php
+++ b/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php
diff --git a/phpBB/includes/db/migration/data/310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/310/reported_posts_display.php
index 80a0a0e43f..80a0a0e43f 100644
--- a/phpBB/includes/db/migration/data/310/reported_posts_display.php
+++ b/phpBB/phpbb/db/migration/data/310/reported_posts_display.php
diff --git a/phpBB/includes/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php
index e4fbb27bcb..e4fbb27bcb 100644
--- a/phpBB/includes/db/migration/data/310/signature_module_auth.php
+++ b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php
diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php
new file mode 100644
index 0000000000..84f8eebd4a
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php
@@ -0,0 +1,171 @@
+<?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_softdelete_p1 extends phpbb_db_migration
+{
+ public function effectively_installed()
+ {
+ return $this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_visibility');
+ }
+
+ static public function depends_on()
+ {
+ return array('phpbb_db_migration_data_310_dev');
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'forums' => array(
+ 'forum_posts_approved' => array('UINT', 0),
+ 'forum_posts_unapproved' => array('UINT', 0),
+ 'forum_posts_softdeleted' => array('UINT', 0),
+ 'forum_topics_approved' => array('UINT', 0),
+ 'forum_topics_unapproved' => array('UINT', 0),
+ 'forum_topics_softdeleted' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'posts' => array(
+ 'post_visibility' => array('TINT:3', 0),
+ 'post_delete_time' => array('TIMESTAMP', 0),
+ 'post_delete_reason' => array('STEXT_UNI', ''),
+ 'post_delete_user' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'topic_visibility' => array('TINT:3', 0),
+ 'topic_delete_time' => array('TIMESTAMP', 0),
+ 'topic_delete_reason' => array('STEXT_UNI', ''),
+ 'topic_delete_user' => array('UINT', 0),
+ 'topic_posts_approved' => array('UINT', 0),
+ 'topic_posts_unapproved' => array('UINT', 0),
+ 'topic_posts_softdeleted' => array('UINT', 0),
+ ),
+ ),
+ 'add_index' => array(
+ $this->table_prefix . 'posts' => array(
+ 'post_visibility' => array('post_visibility'),
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'topic_visibility' => array('topic_visibility'),
+ 'forum_vis_last' => array('forum_id', 'topic_visibility', 'topic_last_post_id'),
+ ),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'drop_columns' => array(
+ $this->table_prefix . 'forums' => array(
+ 'forum_posts_approved',
+ 'forum_posts_unapproved',
+ 'forum_posts_softdeleted',
+ 'forum_topics_approved',
+ 'forum_topics_unapproved',
+ 'forum_topics_softdeleted',
+ ),
+ $this->table_prefix . 'posts' => array(
+ 'post_visibility',
+ 'post_delete_time',
+ 'post_delete_reason',
+ 'post_delete_user',
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'topic_visibility',
+ 'topic_delete_time',
+ 'topic_delete_reason',
+ 'topic_delete_user',
+ 'topic_posts_approved',
+ 'topic_posts_unapproved',
+ 'topic_posts_softdeleted',
+ ),
+ ),
+ 'drop_keys' => array(
+ $this->table_prefix . 'posts' => array('post_visibility'),
+ $this->table_prefix . 'topics' => array('topic_visibility', 'forum_vis_last'),
+ ),
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(array($this, 'update_post_visibility'))),
+ array('custom', array(array($this, 'update_topic_visibility'))),
+ array('custom', array(array($this, 'update_topic_forum_counts'))),
+
+ array('permission.add', array('f_softdelete', false)),
+ array('permission.add', array('m_softdelete', false)),
+ );
+ }
+
+ public function update_post_visibility()
+ {
+ $sql = 'UPDATE ' . $this->table_prefix . 'posts
+ SET post_visibility = post_approved';
+ $this->sql_query($sql);
+ }
+
+ public function update_topic_visibility()
+ {
+ $sql = 'UPDATE ' . $this->table_prefix . 'topics
+ SET topic_visibility = topic_approved';
+ $this->sql_query($sql);
+ }
+
+ public function update_topic_forum_counts()
+ {
+ $sql = 'UPDATE ' . $this->table_prefix . 'topics
+ SET topic_posts_approved = topic_replies + 1,
+ topic_posts_unapproved = topic_replies_real - topic_replies
+ WHERE topic_visibility = ' . ITEM_APPROVED;
+ $this->sql_query($sql);
+
+ $sql = 'UPDATE ' . $this->table_prefix . 'topics
+ SET topic_posts_approved = 0,
+ topic_posts_unapproved = (topic_replies_real - topic_replies) + 1
+ WHERE topic_visibility = ' . ITEM_UNAPPROVED;
+ $this->sql_query($sql);
+
+ $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS sum_topics, SUM(topic_posts_approved) AS sum_posts_approved, SUM(topic_posts_unapproved) AS sum_posts_unapproved
+ FROM ' . $this->table_prefix . 'topics
+ GROUP BY forum_id, topic_visibility';
+ $result = $this->db->sql_query($sql);
+
+ $update_forums = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $forum_id = (int) $row['forum_id'];
+ if (!isset($update_forums[$forum_id]))
+ {
+ $update_forums[$forum_id] = array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ );
+ }
+
+ $update_forums[$forum_id]['forum_posts_approved'] += (int) $row['sum_posts_approved'];
+ $update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved'];
+
+ $update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics_approved' : 'forum_topics_unapproved')] += (int) $row['sum_topics'];
+ }
+ $this->db->sql_freeresult($result);
+
+ foreach ($update_forums as $forum_id => $forum_data)
+ {
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET ' . $this->db->sql_build_array('UPDATE', $forum_data) . '
+ WHERE forum_id = ' . $forum_id;
+ $this->sql_query($sql);
+ }
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php
new file mode 100644
index 0000000000..7320a2c2bf
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php
@@ -0,0 +1,68 @@
+<?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_softdelete_p2 extends phpbb_db_migration
+{
+ public function effectively_installed()
+ {
+ return !$this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_approved');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ 'phpbb_db_migration_data_310_dev',
+ 'phpbb_db_migration_data_310_softdelete_p1',
+ );
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'drop_columns' => array(
+ $this->table_prefix . 'forums' => array('forum_posts', 'forum_topics', 'forum_topics_real'),
+ $this->table_prefix . 'posts' => array('post_approved'),
+ $this->table_prefix . 'topics' => array('topic_approved', 'topic_replies', 'topic_replies_real'),
+ ),
+ 'drop_keys' => array(
+ $this->table_prefix . 'posts' => array('post_approved'),
+ $this->table_prefix . 'topics' => array('forum_appr_last'),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'forums' => array(
+ 'forum_posts' => array('UINT', 0),
+ 'forum_topics' => array('UINT', 0),
+ 'forum_topics_real' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'posts' => array(
+ 'post_approved' => array('BOOL', 1),
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'topic_approved' => array('BOOL', 1),
+ 'topic_replies' => array('UINT', 0),
+ 'topic_replies_real' => array('UINT', 0),
+ ),
+ ),
+ 'add_index' => array(
+ $this->table_prefix . 'posts' => array(
+ 'post_approved' => array('post_approved'),
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'forum_appr_last' => array('forum_id', 'topic_approved', 'topic_last_post_id'),
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/includes/db/migration/data/310/style_update_p1.php b/phpBB/phpbb/db/migration/data/310/style_update_p1.php
index d43537559d..d43537559d 100644
--- a/phpBB/includes/db/migration/data/310/style_update_p1.php
+++ b/phpBB/phpbb/db/migration/data/310/style_update_p1.php
diff --git a/phpBB/includes/db/migration/data/310/style_update_p2.php b/phpBB/phpbb/db/migration/data/310/style_update_p2.php
index 7b10518a66..7b10518a66 100644
--- a/phpBB/includes/db/migration/data/310/style_update_p2.php
+++ b/phpBB/phpbb/db/migration/data/310/style_update_p2.php
diff --git a/phpBB/includes/db/migration/data/310/teampage.php b/phpBB/phpbb/db/migration/data/310/teampage.php
index 4e77da17b7..4e77da17b7 100644
--- a/phpBB/includes/db/migration/data/310/teampage.php
+++ b/phpBB/phpbb/db/migration/data/310/teampage.php
diff --git a/phpBB/includes/db/migration/data/310/timezone.php b/phpBB/phpbb/db/migration/data/310/timezone.php
index 6e50cbe45f..6e50cbe45f 100644
--- a/phpBB/includes/db/migration/data/310/timezone.php
+++ b/phpBB/phpbb/db/migration/data/310/timezone.php
diff --git a/phpBB/includes/db/migration/data/310/timezone_p2.php b/phpBB/phpbb/db/migration/data/310/timezone_p2.php
index 113b979e4f..113b979e4f 100644
--- a/phpBB/includes/db/migration/data/310/timezone_p2.php
+++ b/phpBB/phpbb/db/migration/data/310/timezone_p2.php
diff --git a/phpBB/includes/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php
index e84330dd71..e84330dd71 100644
--- a/phpBB/includes/db/migration/exception.php
+++ b/phpBB/phpbb/db/migration/exception.php
diff --git a/phpBB/includes/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php
index 0ffa96fd14..0ffa96fd14 100644
--- a/phpBB/includes/db/migration/migration.php
+++ b/phpBB/phpbb/db/migration/migration.php
diff --git a/phpBB/includes/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php
index 0b626bf455..0b626bf455 100644
--- a/phpBB/includes/db/migration/tool/config.php
+++ b/phpBB/phpbb/db/migration/tool/config.php
diff --git a/phpBB/includes/db/migration/tool/interface.php b/phpBB/phpbb/db/migration/tool/interface.php
index ced53b2023..ced53b2023 100644
--- a/phpBB/includes/db/migration/tool/interface.php
+++ b/phpBB/phpbb/db/migration/tool/interface.php
diff --git a/phpBB/includes/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php
index ac4d2c9bd7..ac4d2c9bd7 100644
--- a/phpBB/includes/db/migration/tool/module.php
+++ b/phpBB/phpbb/db/migration/tool/module.php
diff --git a/phpBB/includes/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php
index 2f09c0ac72..2f09c0ac72 100644
--- a/phpBB/includes/db/migration/tool/permission.php
+++ b/phpBB/phpbb/db/migration/tool/permission.php
diff --git a/phpBB/includes/db/migrator.php b/phpBB/phpbb/db/migrator.php
index ca3ffc8043..ca3ffc8043 100644
--- a/phpBB/includes/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
diff --git a/phpBB/includes/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php
index c18f908429..c18f908429 100644
--- a/phpBB/includes/db/sql_insert_buffer.php
+++ b/phpBB/phpbb/db/sql_insert_buffer.php
diff --git a/phpBB/includes/db/db_tools.php b/phpBB/phpbb/db/tools.php
index 983cdc18ea..492284ffcd 100644
--- a/phpBB/includes/db/db_tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -303,7 +303,7 @@ class phpbb_db_tools
* @param phpbb_db_driver $db Database connection
* @param bool $return_statements True if only statements should be returned and no SQL being executed
*/
- function phpbb_db_tools(phpbb_db_driver $db, $return_statements = false)
+ public function __construct(phpbb_db_driver $db, $return_statements = false)
{
$this->db = $db;
$this->return_statements = $return_statements;
diff --git a/phpBB/includes/di/extension/config.php b/phpBB/phpbb/di/extension/config.php
index 6c272a6588..6c272a6588 100644
--- a/phpBB/includes/di/extension/config.php
+++ b/phpBB/phpbb/di/extension/config.php
diff --git a/phpBB/includes/di/extension/core.php b/phpBB/phpbb/di/extension/core.php
index 9c36ba2fc4..9c36ba2fc4 100644
--- a/phpBB/includes/di/extension/core.php
+++ b/phpBB/phpbb/di/extension/core.php
diff --git a/phpBB/includes/di/extension/ext.php b/phpBB/phpbb/di/extension/ext.php
index 7d9b433751..7d9b433751 100644
--- a/phpBB/includes/di/extension/ext.php
+++ b/phpBB/phpbb/di/extension/ext.php
diff --git a/phpBB/includes/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php
index 63a5c7dfc4..63a5c7dfc4 100644
--- a/phpBB/includes/di/pass/collection_pass.php
+++ b/phpBB/phpbb/di/pass/collection_pass.php
diff --git a/phpBB/includes/di/pass/kernel_pass.php b/phpBB/phpbb/di/pass/kernel_pass.php
index a701ebcfa6..a701ebcfa6 100644
--- a/phpBB/includes/di/pass/kernel_pass.php
+++ b/phpBB/phpbb/di/pass/kernel_pass.php
diff --git a/phpBB/includes/di/service_collection.php b/phpBB/phpbb/di/service_collection.php
index 880cb46d4d..880cb46d4d 100644
--- a/phpBB/includes/di/service_collection.php
+++ b/phpBB/phpbb/di/service_collection.php
diff --git a/phpBB/includes/error_collector.php b/phpBB/phpbb/error_collector.php
index 358da747b8..358da747b8 100644
--- a/phpBB/includes/error_collector.php
+++ b/phpBB/phpbb/error_collector.php
diff --git a/phpBB/includes/event/data.php b/phpBB/phpbb/event/data.php
index 70718ff0ae..70718ff0ae 100644
--- a/phpBB/includes/event/data.php
+++ b/phpBB/phpbb/event/data.php
diff --git a/phpBB/includes/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php
index 4f637ce3bb..4f637ce3bb 100644
--- a/phpBB/includes/event/dispatcher.php
+++ b/phpBB/phpbb/event/dispatcher.php
diff --git a/phpBB/includes/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php
index d933b943d7..d933b943d7 100644
--- a/phpBB/includes/event/extension_subscriber_loader.php
+++ b/phpBB/phpbb/event/extension_subscriber_loader.php
diff --git a/phpBB/includes/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php
index f90989a74c..f90989a74c 100644
--- a/phpBB/includes/event/kernel_exception_subscriber.php
+++ b/phpBB/phpbb/event/kernel_exception_subscriber.php
diff --git a/phpBB/includes/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php
index afb8464f80..afb8464f80 100644
--- a/phpBB/includes/event/kernel_request_subscriber.php
+++ b/phpBB/phpbb/event/kernel_request_subscriber.php
diff --git a/phpBB/includes/event/kernel_terminate_subscriber.php b/phpBB/phpbb/event/kernel_terminate_subscriber.php
index 1eaf890e42..1eaf890e42 100644
--- a/phpBB/includes/event/kernel_terminate_subscriber.php
+++ b/phpBB/phpbb/event/kernel_terminate_subscriber.php
diff --git a/phpBB/includes/extension/base.php b/phpBB/phpbb/extension/base.php
index c4462b64d8..c4462b64d8 100644
--- a/phpBB/includes/extension/base.php
+++ b/phpBB/phpbb/extension/base.php
diff --git a/phpBB/includes/extension/exception.php b/phpBB/phpbb/extension/exception.php
index e08a8912ea..e08a8912ea 100644
--- a/phpBB/includes/extension/exception.php
+++ b/phpBB/phpbb/extension/exception.php
diff --git a/phpBB/includes/extension/finder.php b/phpBB/phpbb/extension/finder.php
index 49bb2a514f..155a41cda5 100644
--- a/phpBB/includes/extension/finder.php
+++ b/phpBB/phpbb/extension/finder.php
@@ -275,7 +275,7 @@ class phpbb_extension_finder
$classes = array();
foreach ($files as $file => $ext_name)
{
- $file = preg_replace('#^includes/#', '', $file);
+ $file = preg_replace('#^(phpbb|includes)/#', '', $file);
$classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen('.' . $this->php_ext)));
}
@@ -377,7 +377,7 @@ class phpbb_extension_finder
return $files;
}
-
+
/**
* Finds all file system entries matching the configured options for one
* specific extension
diff --git a/phpBB/includes/extension/interface.php b/phpBB/phpbb/extension/interface.php
index 7b36a12bf6..7b36a12bf6 100644
--- a/phpBB/includes/extension/interface.php
+++ b/phpBB/phpbb/extension/interface.php
diff --git a/phpBB/includes/extension/manager.php b/phpBB/phpbb/extension/manager.php
index 4451049d04..4451049d04 100644
--- a/phpBB/includes/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
diff --git a/phpBB/includes/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php
index 14b77c085b..14b77c085b 100644
--- a/phpBB/includes/extension/metadata_manager.php
+++ b/phpBB/phpbb/extension/metadata_manager.php
diff --git a/phpBB/includes/extension/provider.php b/phpBB/phpbb/extension/provider.php
index 45b55e5cab..45b55e5cab 100644
--- a/phpBB/includes/extension/provider.php
+++ b/phpBB/phpbb/extension/provider.php
diff --git a/phpBB/includes/feed/base.php b/phpBB/phpbb/feed/base.php
index af28ee8dc8..296d830932 100644
--- a/phpBB/includes/feed/base.php
+++ b/phpBB/phpbb/feed/base.php
@@ -80,10 +80,11 @@ abstract class phpbb_feed_base
* @param phpbb_cache_driver_interface $cache Cache object
* @param phpbb_user $user User object
* @param phpbb_auth $auth Auth object
+ * @param phpbb_content_visibility $content_visibility Auth object
* @param string $phpEx php file extension
* @return null
*/
- function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, $phpEx)
+ function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, phpbb_content_visibility $content_visibility, $phpEx)
{
$this->config = $config;
$this->helper = $helper;
@@ -91,6 +92,7 @@ abstract class phpbb_feed_base
$this->cache = $cache;
$this->user = $user;
$this->auth = $auth;
+ $this->content_visibility = $content_visibility;
$this->phpEx = $phpEx;
$this->set_keys();
diff --git a/phpBB/includes/feed/factory.php b/phpBB/phpbb/feed/factory.php
index 63a1eb8ef0..63a1eb8ef0 100644
--- a/phpBB/includes/feed/factory.php
+++ b/phpBB/phpbb/feed/factory.php
diff --git a/phpBB/includes/feed/forum.php b/phpBB/phpbb/feed/forum.php
index 7670fbeaaa..b5f0dd0f8f 100644
--- a/phpBB/includes/feed/forum.php
+++ b/phpBB/phpbb/feed/forum.php
@@ -90,14 +90,12 @@ class phpbb_feed_forum extends phpbb_feed_post_base
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' : '') . '
+ AND ' . $this->content_visibility->get_visibility_sql('topic', $this->forum_id) . '
ORDER BY topic_last_post_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -117,14 +115,14 @@ class phpbb_feed_forum extends phpbb_feed_post_base
}
$this->sql = array(
- 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
+ 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'u.username, u.user_id',
'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 ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
AND p.post_time >= ' . $min_post_time . '
AND p.poster_id = u.user_id',
'ORDER_BY' => 'p.post_time DESC',
diff --git a/phpBB/includes/feed/forums.php b/phpBB/phpbb/feed/forums.php
index 72f786aa6a..409097a9f3 100644
--- a/phpBB/includes/feed/forums.php
+++ b/phpBB/phpbb/feed/forums.php
@@ -49,7 +49,7 @@ class phpbb_feed_forums extends phpbb_feed_base
$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',
+ f.forum_topics_approved, f.forum_posts_approved',
'FROM' => array(FORUMS_TABLE => 'f'),
'WHERE' => 'f.forum_type = ' . FORUM_POST . '
AND ' . $this->db->sql_in_set('f.forum_id', $in_fid_ary),
@@ -65,8 +65,8 @@ class phpbb_feed_forums extends phpbb_feed_base
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']);
+ $item_row['statistics'] = $this->user->lang('TOTAL_TOPICS', (int) $row['forum_topics_approved'])
+ . ' ' . $this->separator_stats . ' ' . $this->user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts_approved']);
}
}
}
diff --git a/phpBB/includes/feed/helper.php b/phpBB/phpbb/feed/helper.php
index 93330aa2ad..93330aa2ad 100644
--- a/phpBB/includes/feed/helper.php
+++ b/phpBB/phpbb/feed/helper.php
diff --git a/phpBB/includes/feed/news.php b/phpBB/phpbb/feed/news.php
index 92cc18a3ab..f2d45b5165 100644
--- a/phpBB/includes/feed/news.php
+++ b/phpBB/phpbb/feed/news.php
@@ -72,7 +72,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base
FROM ' . TOPICS_TABLE . '
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
AND topic_moved_id = 0
- AND topic_approved = 1
+ AND topic_visibility = ' . ITEM_APPROVED . '
ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -90,7 +90,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
- t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time,
+ t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time,
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
'FROM' => array(
TOPICS_TABLE => 't',
diff --git a/phpBB/includes/feed/overall.php b/phpBB/phpbb/feed/overall.php
index 5fb922f6bb..224d97ec03 100644
--- a/phpBB/includes/feed/overall.php
+++ b/phpBB/phpbb/feed/overall.php
@@ -33,17 +33,11 @@ class phpbb_feed_overall extends phpbb_feed_post_base
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 . ')
+ WHERE topic_moved_id = 0
+ AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids) . '
ORDER BY topic_last_post_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -65,7 +59,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
// Get the actual data
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name, ' .
- 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
+ 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'u.username, u.user_id',
'FROM' => array(
USERS_TABLE => 'u',
@@ -78,8 +72,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
),
),
'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 ' . $this->content_visibility->get_forums_visibility_sql('post', $forum_ids, 'p.') . '
AND p.post_time >= ' . $min_post_time . '
AND u.user_id = p.poster_id',
'ORDER_BY' => 'p.post_time DESC',
diff --git a/phpBB/includes/feed/post_base.php b/phpBB/phpbb/feed/post_base.php
index a25ed50263..1f4cb4b5ef 100644
--- a/phpBB/includes/feed/post_base.php
+++ b/phpBB/phpbb/feed/post_base.php
@@ -51,7 +51,7 @@ abstract class phpbb_feed_post_base extends phpbb_feed_base
{
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
- . (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '');
+ . (($this->is_moderator_approve_forum($row['forum_id']) && $row['post_visibility'] !== ITEM_APPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '');
}
}
}
diff --git a/phpBB/includes/feed/topic.php b/phpBB/phpbb/feed/topic.php
index 7d9a344982..bb1753d823 100644
--- a/phpBB/includes/feed/topic.php
+++ b/phpBB/phpbb/feed/topic.php
@@ -43,7 +43,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base
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
+ $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_posts_approved, t.topic_type
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . FORUMS_TABLE . ' f
ON (f.forum_id = t.forum_id)
@@ -60,7 +60,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base
$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))
+ if ($this->topic_data['topic_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $this->forum_id))
{
trigger_error('SORRY_AUTH_READ');
}
@@ -94,14 +94,14 @@ class phpbb_feed_topic extends phpbb_feed_post_base
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, ' .
+ 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'u.username, u.user_id',
'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 ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
AND p.poster_id = u.user_id',
'ORDER_BY' => 'p.post_time DESC',
);
diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php
index e6a47b4c86..b104a46631 100644
--- a/phpBB/includes/feed/topic_base.php
+++ b/phpBB/phpbb/feed/topic_base.php
@@ -51,9 +51,9 @@ abstract class phpbb_feed_topic_base extends phpbb_feed_base
{
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
- . ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'])
+ . ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . $this->content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1
. ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views']
- . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : '');
+ . (($this->is_moderator_approve_forum($row['forum_id']) && $row['topic_posts_unapproved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : '');
}
}
}
diff --git a/phpBB/includes/feed/topics.php b/phpBB/phpbb/feed/topics.php
index c8761d7176..31f5177773 100644
--- a/phpBB/includes/feed/topics.php
+++ b/phpBB/phpbb/feed/topics.php
@@ -44,7 +44,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
FROM ' . TOPICS_TABLE . '
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
AND topic_moved_id = 0
- AND topic_approved = 1
+ AND topic_visibility = ' . ITEM_APPROVED . '
ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -62,7 +62,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
- t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time,
+ t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time,
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
'FROM' => array(
TOPICS_TABLE => 't',
diff --git a/phpBB/includes/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php
index d1c920c136..249dd1d66a 100644
--- a/phpBB/includes/feed/topics_active.php
+++ b/phpBB/phpbb/feed/topics_active.php
@@ -59,7 +59,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base
FROM ' . TOPICS_TABLE . '
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
AND topic_moved_id = 0
- AND topic_approved = 1
+ AND topic_visibility = ' . ITEM_APPROVED . '
' . $last_post_time_sql . '
ORDER BY topic_last_post_time DESC';
$result = $this->db->sql_query_limit($sql, $this->num_items);
@@ -78,7 +78,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base
$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_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views,
t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time,
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
'FROM' => array(
diff --git a/phpBB/includes/filesystem.php b/phpBB/phpbb/filesystem.php
index 27cab48fb0..27cab48fb0 100644
--- a/phpBB/includes/filesystem.php
+++ b/phpBB/phpbb/filesystem.php
diff --git a/phpBB/includes/groupposition/exception.php b/phpBB/phpbb/groupposition/exception.php
index e4ff09c703..e4ff09c703 100644
--- a/phpBB/includes/groupposition/exception.php
+++ b/phpBB/phpbb/groupposition/exception.php
diff --git a/phpBB/includes/groupposition/interface.php b/phpBB/phpbb/groupposition/interface.php
index eacc04e1a4..eacc04e1a4 100644
--- a/phpBB/includes/groupposition/interface.php
+++ b/phpBB/phpbb/groupposition/interface.php
diff --git a/phpBB/includes/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php
index 7fddadde99..7fddadde99 100644
--- a/phpBB/includes/groupposition/legend.php
+++ b/phpBB/phpbb/groupposition/legend.php
diff --git a/phpBB/includes/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php
index 7c758199e7..7c758199e7 100644
--- a/phpBB/includes/groupposition/teampage.php
+++ b/phpBB/phpbb/groupposition/teampage.php
diff --git a/phpBB/includes/hook/finder.php b/phpBB/phpbb/hook/finder.php
index 7b0412f733..7b0412f733 100644
--- a/phpBB/includes/hook/finder.php
+++ b/phpBB/phpbb/hook/finder.php
diff --git a/phpBB/includes/json_response.php b/phpBB/phpbb/json_response.php
index 5dd904da09..5dd904da09 100644
--- a/phpBB/includes/json_response.php
+++ b/phpBB/phpbb/json_response.php
diff --git a/phpBB/includes/lock/db.php b/phpBB/phpbb/lock/db.php
index 5cc0821aa0..5cc0821aa0 100644
--- a/phpBB/includes/lock/db.php
+++ b/phpBB/phpbb/lock/db.php
diff --git a/phpBB/includes/lock/flock.php b/phpBB/phpbb/lock/flock.php
index 17de0847c0..17de0847c0 100644
--- a/phpBB/includes/lock/flock.php
+++ b/phpBB/phpbb/lock/flock.php
diff --git a/phpBB/includes/log/interface.php b/phpBB/phpbb/log/interface.php
index 3b459c9bdf..3b459c9bdf 100644
--- a/phpBB/includes/log/interface.php
+++ b/phpBB/phpbb/log/interface.php
diff --git a/phpBB/includes/log/log.php b/phpBB/phpbb/log/log.php
index 7a26858348..7a26858348 100644
--- a/phpBB/includes/log/log.php
+++ b/phpBB/phpbb/log/log.php
diff --git a/phpBB/includes/notification/exception.php b/phpBB/phpbb/notification/exception.php
index a52d6fdc57..a52d6fdc57 100644
--- a/phpBB/includes/notification/exception.php
+++ b/phpBB/phpbb/notification/exception.php
diff --git a/phpBB/includes/notification/manager.php b/phpBB/phpbb/notification/manager.php
index 97833710c0..97833710c0 100644
--- a/phpBB/includes/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
diff --git a/phpBB/includes/notification/method/base.php b/phpBB/phpbb/notification/method/base.php
index b633956d01..b633956d01 100644
--- a/phpBB/includes/notification/method/base.php
+++ b/phpBB/phpbb/notification/method/base.php
diff --git a/phpBB/includes/notification/method/email.php b/phpBB/phpbb/notification/method/email.php
index 571b0ec656..571b0ec656 100644
--- a/phpBB/includes/notification/method/email.php
+++ b/phpBB/phpbb/notification/method/email.php
diff --git a/phpBB/includes/notification/method/interface.php b/phpBB/phpbb/notification/method/interface.php
index ef875942cc..ef875942cc 100644
--- a/phpBB/includes/notification/method/interface.php
+++ b/phpBB/phpbb/notification/method/interface.php
diff --git a/phpBB/includes/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php
index d3b756d020..d3b756d020 100644
--- a/phpBB/includes/notification/method/jabber.php
+++ b/phpBB/phpbb/notification/method/jabber.php
diff --git a/phpBB/includes/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php
index 4966aa94bc..4966aa94bc 100644
--- a/phpBB/includes/notification/method/messenger_base.php
+++ b/phpBB/phpbb/notification/method/messenger_base.php
diff --git a/phpBB/includes/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php
index 1a30781c35..1a30781c35 100644
--- a/phpBB/includes/notification/type/approve_post.php
+++ b/phpBB/phpbb/notification/type/approve_post.php
diff --git a/phpBB/includes/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php
index e728e9ac30..e728e9ac30 100644
--- a/phpBB/includes/notification/type/approve_topic.php
+++ b/phpBB/phpbb/notification/type/approve_topic.php
diff --git a/phpBB/includes/notification/type/base.php b/phpBB/phpbb/notification/type/base.php
index 46517f1c9b..46517f1c9b 100644
--- a/phpBB/includes/notification/type/base.php
+++ b/phpBB/phpbb/notification/type/base.php
diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php
index ae2e75d3eb..ae2e75d3eb 100644
--- a/phpBB/includes/notification/type/bookmark.php
+++ b/phpBB/phpbb/notification/type/bookmark.php
diff --git a/phpBB/includes/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php
index 951c7e0254..951c7e0254 100644
--- a/phpBB/includes/notification/type/disapprove_post.php
+++ b/phpBB/phpbb/notification/type/disapprove_post.php
diff --git a/phpBB/includes/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php
index 038e528797..038e528797 100644
--- a/phpBB/includes/notification/type/disapprove_topic.php
+++ b/phpBB/phpbb/notification/type/disapprove_topic.php
diff --git a/phpBB/includes/notification/type/interface.php b/phpBB/phpbb/notification/type/interface.php
index a40fdafd09..a40fdafd09 100644
--- a/phpBB/includes/notification/type/interface.php
+++ b/phpBB/phpbb/notification/type/interface.php
diff --git a/phpBB/includes/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php
index b3db7ad5ad..b3db7ad5ad 100644
--- a/phpBB/includes/notification/type/pm.php
+++ b/phpBB/phpbb/notification/type/pm.php
diff --git a/phpBB/includes/notification/type/post.php b/phpBB/phpbb/notification/type/post.php
index 9207fd866e..9207fd866e 100644
--- a/phpBB/includes/notification/type/post.php
+++ b/phpBB/phpbb/notification/type/post.php
diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php
index bc4b15cdc3..bc4b15cdc3 100644
--- a/phpBB/includes/notification/type/post_in_queue.php
+++ b/phpBB/phpbb/notification/type/post_in_queue.php
diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php
index 0ed13f36fb..0ed13f36fb 100644
--- a/phpBB/includes/notification/type/quote.php
+++ b/phpBB/phpbb/notification/type/quote.php
diff --git a/phpBB/includes/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php
index 3fa73bab41..3fa73bab41 100644
--- a/phpBB/includes/notification/type/report_pm.php
+++ b/phpBB/phpbb/notification/type/report_pm.php
diff --git a/phpBB/includes/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php
index 63dfa92064..63dfa92064 100644
--- a/phpBB/includes/notification/type/report_pm_closed.php
+++ b/phpBB/phpbb/notification/type/report_pm_closed.php
diff --git a/phpBB/includes/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php
index de5c54a291..de5c54a291 100644
--- a/phpBB/includes/notification/type/report_post.php
+++ b/phpBB/phpbb/notification/type/report_post.php
diff --git a/phpBB/includes/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php
index 3916cd8db7..3916cd8db7 100644
--- a/phpBB/includes/notification/type/report_post_closed.php
+++ b/phpBB/phpbb/notification/type/report_post_closed.php
diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php
index 22436d3fb1..22436d3fb1 100644
--- a/phpBB/includes/notification/type/topic.php
+++ b/phpBB/phpbb/notification/type/topic.php
diff --git a/phpBB/includes/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php
index f735e10c00..f735e10c00 100644
--- a/phpBB/includes/notification/type/topic_in_queue.php
+++ b/phpBB/phpbb/notification/type/topic_in_queue.php
diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php
new file mode 100644
index 0000000000..0fbacdad8a
--- /dev/null
+++ b/phpBB/phpbb/permissions.php
@@ -0,0 +1,340 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* DO NOT CHANGE
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+class phpbb_permissions
+{
+ /**
+ * Event dispatcher object
+ * @var phpbb_event_dispatcher
+ */
+ protected $dispatcher;
+
+ /**
+ * User object
+ * @var phpbb_user
+ */
+ protected $user;
+
+ /**
+ * Constructor
+ *
+ * @param phpbb_event_dispatcher $phpbb_dispatcher Event dispatcher
+ * @param phpbb_user $user User Object
+ * @return null
+ */
+ public function __construct(phpbb_event_dispatcher $phpbb_dispatcher, phpbb_user $user)
+ {
+ $this->dispatcher = $phpbb_dispatcher;
+ $this->user = $user;
+
+ $categories = $this->categories;
+ $types = $this->types;
+ $permissions = $this->permissions;
+
+ /**
+ * Allows to specify additional permission categories, types and permissions
+ *
+ * @event core.permissions
+ * @var array types Array with permission types (a_, u_, m_, etc.)
+ * @var array categories Array with permission categories (pm, post, settings, misc, etc.)
+ * @var array permissions Array with permissions. Each Permission has the following layout:
+ * '<type><permission>' => array(
+ * 'lang' => 'Language Key with a Short description', // Optional, if not set,
+ * // the permissions identifier '<type><permission>' is used with
+ * // all uppercase.
+ * 'cat' => 'Identifier of the category, the permission should be displayed in',
+ * ),
+ * Example:
+ * 'u_viewprofile' => array(
+ * 'lang' => 'ACL_U_VIEWPROFILE',
+ * 'cat' => 'profile',
+ * ),
+ * @since 3.1-A1
+ */
+ $vars = array('types', 'categories', 'permissions');
+ extract($phpbb_dispatcher->trigger_event('core.permissions', compact($vars)));
+
+ $this->categories = $categories;
+ $this->types = $types;
+ $this->permissions = $permissions;
+ }
+
+ /**
+ * Returns an array with all the permission categories (pm, post, settings, misc, etc.)
+ *
+ * @return array Layout: cat-identifier => Language key
+ */
+ public function get_categories()
+ {
+ return $this->categories;
+ }
+
+ /**
+ * Returns the language string of a permission category
+ *
+ * @param string $category Identifier of the category
+ * @return string Language string
+ */
+ public function get_category_lang($category)
+ {
+ return $this->user->lang($this->categories[$category]);
+ }
+
+ /**
+ * Returns an array with all the permission types (a_, u_, m_, etc.)
+ *
+ * @return array Layout: type-identifier => Language key
+ */
+ public function get_types()
+ {
+ return $this->types;
+ }
+
+ /**
+ * Returns the language string of a permission type
+ *
+ * @param string $type Identifier of the type
+ * @param mixed $scope Scope of the type (should be 'global', 'local' or false)
+ * @return string Language string
+ */
+ public function get_type_lang($type, $scope = false)
+ {
+ if ($scope && isset($this->types[$scope][$type]))
+ {
+ $lang_key = $this->types[$scope][$type];
+ }
+ else if (isset($this->types[$type]))
+ {
+ $lang_key = $this->types[$type];
+ }
+ else
+ {
+ $lang_key = 'ACL_TYPE_' . strtoupper(($scope) ? $scope . '_' . $type : $type);
+ }
+
+ return $this->user->lang($lang_key);
+ }
+
+ /**
+ * Returns an array with all the permissions.
+ * Each Permission has the following layout:
+ * '<type><permission>' => array(
+ * 'lang' => 'Language Key with a Short description', // Optional, if not set,
+ * // the permissions identifier '<type><permission>' is used with
+ * // all uppercase.
+ * 'cat' => 'Identifier of the category, the permission should be displayed in',
+ * ),
+ * Example:
+ * 'u_viewprofile' => array(
+ * 'lang' => 'ACL_U_VIEWPROFILE',
+ * 'cat' => 'profile',
+ * ),
+ *
+ * @return array
+ */
+ public function get_permissions()
+ {
+ return $this->permissions;
+ }
+
+ /**
+ * Returns the category of a permission
+ *
+ * @param string $permission Identifier of the permission
+ * @return string Returns the category identifier of the permission
+ */
+ public function get_permission_category($permission)
+ {
+ return (isset($this->permissions[$permission]['cat'])) ? $this->permissions[$permission]['cat'] : 'misc';
+ }
+
+ /**
+ * Returns the language string of a permission
+ *
+ * @param string $permission Identifier of the permission
+ * @return string Language string
+ */
+ public function get_permission_lang($permission)
+ {
+ return (isset($this->permissions[$permission]['lang'])) ? $this->user->lang($this->permissions[$permission]['lang']) : $this->user->lang('ACL_' . strtoupper($permission));
+ }
+
+ protected $types = array(
+ 'u_' => 'ACL_TYPE_U_',
+ 'a_' => 'ACL_TYPE_A_',
+ 'm_' => 'ACL_TYPE_M_',
+ 'f_' => 'ACL_TYPE_F_',
+ 'global' => array(
+ 'm_' => 'ACL_TYPE_GLOBAL_M_',
+ ),
+ );
+
+ protected $categories = array(
+ 'actions' => 'ACL_CAT_ACTIONS',
+ 'content' => 'ACL_CAT_CONTENT',
+ 'forums' => 'ACL_CAT_FORUMS',
+ 'misc' => 'ACL_CAT_MISC',
+ 'permissions' => 'ACL_CAT_PERMISSIONS',
+ 'pm' => 'ACL_CAT_PM',
+ 'polls' => 'ACL_CAT_POLLS',
+ 'post' => 'ACL_CAT_POST',
+ 'post_actions' => 'ACL_CAT_POST_ACTIONS',
+ 'posting' => 'ACL_CAT_POSTING',
+ 'profile' => 'ACL_CAT_PROFILE',
+ 'settings' => 'ACL_CAT_SETTINGS',
+ 'topic_actions' => 'ACL_CAT_TOPIC_ACTIONS',
+ 'user_group' => 'ACL_CAT_USER_GROUP',
+ );
+
+ protected $permissions = array(
+ // User Permissions
+ 'u_viewprofile' => array('lang' => 'ACL_U_VIEWPROFILE', 'cat' => 'profile'),
+ 'u_chgname' => array('lang' => 'ACL_U_CHGNAME', 'cat' => 'profile'),
+ 'u_chgpasswd' => array('lang' => 'ACL_U_CHGPASSWD', 'cat' => 'profile'),
+ 'u_chgemail' => array('lang' => 'ACL_U_CHGEMAIL', 'cat' => 'profile'),
+ 'u_chgavatar' => array('lang' => 'ACL_U_CHGAVATAR', 'cat' => 'profile'),
+ 'u_chggrp' => array('lang' => 'ACL_U_CHGGRP', 'cat' => 'profile'),
+ 'u_chgprofileinfo' => array('lang' => 'ACL_U_CHGPROFILEINFO', 'cat' => 'profile'),
+
+ 'u_attach' => array('lang' => 'ACL_U_ATTACH', 'cat' => 'post'),
+ 'u_download' => array('lang' => 'ACL_U_DOWNLOAD', 'cat' => 'post'),
+ 'u_savedrafts' => array('lang' => 'ACL_U_SAVEDRAFTS', 'cat' => 'post'),
+ 'u_chgcensors' => array('lang' => 'ACL_U_CHGCENSORS', 'cat' => 'post'),
+ 'u_sig' => array('lang' => 'ACL_U_SIG', 'cat' => 'post'),
+
+ 'u_sendpm' => array('lang' => 'ACL_U_SENDPM', 'cat' => 'pm'),
+ 'u_masspm' => array('lang' => 'ACL_U_MASSPM', 'cat' => 'pm'),
+ 'u_masspm_group'=> array('lang' => 'ACL_U_MASSPM_GROUP', 'cat' => 'pm'),
+ 'u_readpm' => array('lang' => 'ACL_U_READPM', 'cat' => 'pm'),
+ 'u_pm_edit' => array('lang' => 'ACL_U_PM_EDIT', 'cat' => 'pm'),
+ 'u_pm_delete' => array('lang' => 'ACL_U_PM_DELETE', 'cat' => 'pm'),
+ 'u_pm_forward' => array('lang' => 'ACL_U_PM_FORWARD', 'cat' => 'pm'),
+ 'u_pm_emailpm' => array('lang' => 'ACL_U_PM_EMAILPM', 'cat' => 'pm'),
+ 'u_pm_printpm' => array('lang' => 'ACL_U_PM_PRINTPM', 'cat' => 'pm'),
+ 'u_pm_attach' => array('lang' => 'ACL_U_PM_ATTACH', 'cat' => 'pm'),
+ 'u_pm_download' => array('lang' => 'ACL_U_PM_DOWNLOAD', 'cat' => 'pm'),
+ 'u_pm_bbcode' => array('lang' => 'ACL_U_PM_BBCODE', 'cat' => 'pm'),
+ 'u_pm_smilies' => array('lang' => 'ACL_U_PM_SMILIES', 'cat' => 'pm'),
+ 'u_pm_img' => array('lang' => 'ACL_U_PM_IMG', 'cat' => 'pm'),
+ 'u_pm_flash' => array('lang' => 'ACL_U_PM_FLASH', 'cat' => 'pm'),
+
+ 'u_sendemail' => array('lang' => 'ACL_U_SENDEMAIL', 'cat' => 'misc'),
+ 'u_sendim' => array('lang' => 'ACL_U_SENDIM', 'cat' => 'misc'),
+ 'u_ignoreflood' => array('lang' => 'ACL_U_IGNOREFLOOD', 'cat' => 'misc'),
+ 'u_hideonline' => array('lang' => 'ACL_U_HIDEONLINE', 'cat' => 'misc'),
+ 'u_viewonline' => array('lang' => 'ACL_U_VIEWONLINE', 'cat' => 'misc'),
+ 'u_search' => array('lang' => 'ACL_U_SEARCH', 'cat' => 'misc'),
+
+ // Forum Permissions
+ 'f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'),
+ 'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'),
+ 'f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'),
+ 'f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'),
+ 'f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'),
+ 'f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'),
+ 'f_bump' => array('lang' => 'ACL_F_BUMP', 'cat' => 'actions'),
+ 'f_user_lock' => array('lang' => 'ACL_F_USER_LOCK', 'cat' => 'actions'),
+ 'f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'),
+ 'f_report' => array('lang' => 'ACL_F_REPORT', 'cat' => 'actions'),
+
+ 'f_post' => array('lang' => 'ACL_F_POST', 'cat' => 'post'),
+ 'f_sticky' => array('lang' => 'ACL_F_STICKY', 'cat' => 'post'),
+ 'f_announce' => array('lang' => 'ACL_F_ANNOUNCE', 'cat' => 'post'),
+ 'f_reply' => array('lang' => 'ACL_F_REPLY', 'cat' => 'post'),
+ 'f_edit' => array('lang' => 'ACL_F_EDIT', 'cat' => 'post'),
+ 'f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'),
+ 'f_ignoreflood' => array('lang' => 'ACL_F_IGNOREFLOOD', 'cat' => 'post'),
+ 'f_postcount' => array('lang' => 'ACL_F_POSTCOUNT', 'cat' => 'post'),
+ 'f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'),
+
+ 'f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'),
+ 'f_icons' => array('lang' => 'ACL_F_ICONS', 'cat' => 'content'),
+ 'f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'),
+ 'f_flash' => array('lang' => 'ACL_F_FLASH', 'cat' => 'content'),
+ 'f_img' => array('lang' => 'ACL_F_IMG', 'cat' => 'content'),
+ 'f_sigs' => array('lang' => 'ACL_F_SIGS', 'cat' => 'content'),
+ 'f_smilies' => array('lang' => 'ACL_F_SMILIES', 'cat' => 'content'),
+
+ 'f_poll' => array('lang' => 'ACL_F_POLL', 'cat' => 'polls'),
+ 'f_vote' => array('lang' => 'ACL_F_VOTE', 'cat' => 'polls'),
+ 'f_votechg' => array('lang' => 'ACL_F_VOTECHG', 'cat' => 'polls'),
+
+ // Moderator Permissions
+ 'm_edit' => array('lang' => 'ACL_M_EDIT', 'cat' => 'post_actions'),
+ 'm_delete' => array('lang' => 'ACL_M_DELETE', 'cat' => 'post_actions'),
+ 'm_approve' => array('lang' => 'ACL_M_APPROVE', 'cat' => 'post_actions'),
+ 'm_report' => array('lang' => 'ACL_M_REPORT', 'cat' => 'post_actions'),
+ 'm_chgposter' => array('lang' => 'ACL_M_CHGPOSTER', 'cat' => 'post_actions'),
+
+ 'm_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'),
+ 'm_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'),
+ 'm_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'),
+ 'm_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'),
+
+ 'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'misc'),
+ 'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'),
+ 'm_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'),
+
+ // Admin Permissions
+ 'a_board' => array('lang' => 'ACL_A_BOARD', 'cat' => 'settings'),
+ 'a_server' => array('lang' => 'ACL_A_SERVER', 'cat' => 'settings'),
+ 'a_jabber' => array('lang' => 'ACL_A_JABBER', 'cat' => 'settings'),
+ 'a_phpinfo' => array('lang' => 'ACL_A_PHPINFO', 'cat' => 'settings'),
+
+ 'a_forum' => array('lang' => 'ACL_A_FORUM', 'cat' => 'forums'),
+ 'a_forumadd' => array('lang' => 'ACL_A_FORUMADD', 'cat' => 'forums'),
+ 'a_forumdel' => array('lang' => 'ACL_A_FORUMDEL', 'cat' => 'forums'),
+ 'a_prune' => array('lang' => 'ACL_A_PRUNE', 'cat' => 'forums'),
+
+ 'a_icons' => array('lang' => 'ACL_A_ICONS', 'cat' => 'posting'),
+ 'a_words' => array('lang' => 'ACL_A_WORDS', 'cat' => 'posting'),
+ 'a_bbcode' => array('lang' => 'ACL_A_BBCODE', 'cat' => 'posting'),
+ 'a_attach' => array('lang' => 'ACL_A_ATTACH', 'cat' => 'posting'),
+
+ 'a_user' => array('lang' => 'ACL_A_USER', 'cat' => 'user_group'),
+ 'a_userdel' => array('lang' => 'ACL_A_USERDEL', 'cat' => 'user_group'),
+ 'a_group' => array('lang' => 'ACL_A_GROUP', 'cat' => 'user_group'),
+ 'a_groupadd' => array('lang' => 'ACL_A_GROUPADD', 'cat' => 'user_group'),
+ 'a_groupdel' => array('lang' => 'ACL_A_GROUPDEL', 'cat' => 'user_group'),
+ 'a_ranks' => array('lang' => 'ACL_A_RANKS', 'cat' => 'user_group'),
+ 'a_profile' => array('lang' => 'ACL_A_PROFILE', 'cat' => 'user_group'),
+ 'a_names' => array('lang' => 'ACL_A_NAMES', 'cat' => 'user_group'),
+ 'a_ban' => array('lang' => 'ACL_A_BAN', 'cat' => 'user_group'),
+
+ 'a_viewauth' => array('lang' => 'ACL_A_VIEWAUTH', 'cat' => 'permissions'),
+ 'a_authgroups' => array('lang' => 'ACL_A_AUTHGROUPS', 'cat' => 'permissions'),
+ 'a_authusers' => array('lang' => 'ACL_A_AUTHUSERS', 'cat' => 'permissions'),
+ 'a_fauth' => array('lang' => 'ACL_A_FAUTH', 'cat' => 'permissions'),
+ 'a_mauth' => array('lang' => 'ACL_A_MAUTH', 'cat' => 'permissions'),
+ 'a_aauth' => array('lang' => 'ACL_A_AAUTH', 'cat' => 'permissions'),
+ 'a_uauth' => array('lang' => 'ACL_A_UAUTH', 'cat' => 'permissions'),
+ 'a_roles' => array('lang' => 'ACL_A_ROLES', 'cat' => 'permissions'),
+ 'a_switchperm' => array('lang' => 'ACL_A_SWITCHPERM', 'cat' => 'permissions'),
+
+ 'a_styles' => array('lang' => 'ACL_A_STYLES', 'cat' => 'misc'),
+ 'a_extensions' => array('lang' => 'ACL_A_EXTENSIONS', 'cat' => 'misc'),
+ 'a_viewlogs' => array('lang' => 'ACL_A_VIEWLOGS', 'cat' => 'misc'),
+ 'a_clearlogs' => array('lang' => 'ACL_A_CLEARLOGS', 'cat' => 'misc'),
+ 'a_modules' => array('lang' => 'ACL_A_MODULES', 'cat' => 'misc'),
+ 'a_language' => array('lang' => 'ACL_A_LANGUAGE', 'cat' => 'misc'),
+ 'a_email' => array('lang' => 'ACL_A_EMAIL', 'cat' => 'misc'),
+ 'a_bots' => array('lang' => 'ACL_A_BOTS', 'cat' => 'misc'),
+ 'a_reasons' => array('lang' => 'ACL_A_REASONS', 'cat' => 'misc'),
+ 'a_backup' => array('lang' => 'ACL_A_BACKUP', 'cat' => 'misc'),
+ 'a_search' => array('lang' => 'ACL_A_SEARCH', 'cat' => 'misc'),
+ );
+}
diff --git a/phpBB/includes/php/ini.php b/phpBB/phpbb/php/ini.php
index 17e8c54a57..17e8c54a57 100644
--- a/phpBB/includes/php/ini.php
+++ b/phpBB/phpbb/php/ini.php
diff --git a/phpBB/includes/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php
index cc05847ec7..cc05847ec7 100644
--- a/phpBB/includes/request/deactivated_super_global.php
+++ b/phpBB/phpbb/request/deactivated_super_global.php
diff --git a/phpBB/includes/request/interface.php b/phpBB/phpbb/request/interface.php
index 741db35917..741db35917 100644
--- a/phpBB/includes/request/interface.php
+++ b/phpBB/phpbb/request/interface.php
diff --git a/phpBB/includes/request/request.php b/phpBB/phpbb/request/request.php
index ae3c526d89..ae3c526d89 100644
--- a/phpBB/includes/request/request.php
+++ b/phpBB/phpbb/request/request.php
diff --git a/phpBB/includes/request/type_cast_helper.php b/phpBB/phpbb/request/type_cast_helper.php
index 1a5274ed14..1a5274ed14 100644
--- a/phpBB/includes/request/type_cast_helper.php
+++ b/phpBB/phpbb/request/type_cast_helper.php
diff --git a/phpBB/includes/request/type_cast_helper_interface.php b/phpBB/phpbb/request/type_cast_helper_interface.php
index 3920d16fc7..3920d16fc7 100644
--- a/phpBB/includes/request/type_cast_helper_interface.php
+++ b/phpBB/phpbb/request/type_cast_helper_interface.php
diff --git a/phpBB/includes/search/base.php b/phpBB/phpbb/search/base.php
index 914cef9167..914cef9167 100644
--- a/phpBB/includes/search/base.php
+++ b/phpBB/phpbb/search/base.php
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php
index b16a7df606..a1e1b089b9 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -351,7 +351,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -360,7 +360,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
- public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
+ public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No keywords? No posts
if (!$this->search_query)
@@ -378,7 +378,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary)
)));
@@ -445,19 +445,6 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary === array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
-
$sql_select = (!$result_count) ? 'SQL_CALC_FOUND_ROWS ' : '';
$sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id';
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
@@ -480,7 +467,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
- $sql_where_options .= $m_approve_fid_sql;
+ $sql_where_options .= ' AND ' . $post_visibility;
$sql_where_options .= $sql_author;
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_where_options .= $sql_match_where;
@@ -546,7 +533,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -555,7 +542,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
- public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
+ public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No author? No posts
if (!sizeof($author_ary))
@@ -574,7 +561,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary),
$author_name,
)));
@@ -629,18 +616,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary == array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
+ $m_approve_fid_sql = ' AND ' . $post_visibility;
// If the cache was completely empty count the results
$calc_results = ($result_count) ? '' : 'SQL_CALC_FOUND_ROWS ';
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index b9c784ea67..730c3a6c2d 100644
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -507,7 +507,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -516,7 +516,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
- public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
+ public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No keywords? No posts.
if (empty($this->search_query))
@@ -544,7 +544,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary),
$author_name,
)));
@@ -721,14 +721,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
$sql_where[] = '(' . implode(' OR ', $is_null_joins) . ')';
}
- if (!sizeof($m_approve_fid_ary))
- {
- $sql_where[] = 'p.post_approved = 1';
- }
- else if ($m_approve_fid_ary !== array(-1))
- {
- $sql_where[] = '(p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
+ $sql_where[] = $post_visibility;
if ($topic_id)
{
@@ -911,7 +904,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -920,7 +913,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
- public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
+ public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No author? No posts
if (!sizeof($author_ary))
@@ -939,7 +932,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary),
$author_name,
)));
@@ -967,6 +960,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
$sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : '';
+ $post_visibility = ($post_visibility) ? ' AND ' . $post_visibility : '';
// Build sql strings for sorting
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
@@ -989,19 +983,6 @@ class phpbb_search_fulltext_native extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary == array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
-
$select = ($type == 'posts') ? 'p.post_id' : 't.topic_id';
$is_mysql = false;
@@ -1024,7 +1005,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
WHERE $sql_author
$sql_topic_id
$sql_firstpost
- $m_approve_fid_sql
+ $post_visibility
$sql_fora
$sql_time";
}
@@ -1044,7 +1025,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
WHERE $sql_author
$sql_topic_id
$sql_firstpost
- $m_approve_fid_sql
+ $post_visibility
$sql_fora
AND t.topic_id = p.topic_id
$sql_time" . (($this->db->sql_layer == 'sqlite') ? ')' : '');
@@ -1070,7 +1051,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
WHERE $sql_author
$sql_topic_id
$sql_firstpost
- $m_approve_fid_sql
+ $post_visibility
$sql_fora
$sql_sort_join
$sql_time
@@ -1084,7 +1065,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
WHERE $sql_author
$sql_topic_id
$sql_firstpost
- $m_approve_fid_sql
+ $post_visibility
$sql_fora
AND t.topic_id = p.topic_id
$sql_sort_join
diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php
index 758c3ba061..6b4b310f2e 100644
--- a/phpBB/includes/search/fulltext_postgres.php
+++ b/phpBB/phpbb/search/fulltext_postgres.php
@@ -334,7 +334,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -343,7 +343,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
- public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
+ public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No keywords? No posts
if (!$this->search_query)
@@ -367,7 +367,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary)
)));
@@ -434,19 +434,6 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary === array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
-
$sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id';
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
$field = ($type == 'posts') ? 'post_id' : 'topic_id';
@@ -470,7 +457,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
- $sql_where_options .= $m_approve_fid_sql;
+ $sql_where_options .= ' AND ' . $post_visibility;
$sql_where_options .= $sql_author;
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_where_options .= $sql_match_where;
@@ -550,7 +537,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -559,7 +546,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
- public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
+ public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No author? No posts
if (!sizeof($author_ary))
@@ -578,7 +565,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
- implode(',', $m_approve_fid_ary),
+ $post_visibility,
implode(',', $author_ary),
$author_name,
)));
@@ -633,18 +620,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
break;
}
- if (!sizeof($m_approve_fid_ary))
- {
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
- else if ($m_approve_fid_ary == array(-1))
- {
- $m_approve_fid_sql = '';
- }
- else
- {
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
- }
+ $m_approve_fid_sql = ' AND ' . $post_visibility;
// Build the query for really selecting the post_ids
if ($type == 'posts')
diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
index 889324bbda..4f3f852664 100644
--- a/phpBB/includes/search/fulltext_sphinx.php
+++ b/phpBB/phpbb/search/fulltext_sphinx.php
@@ -135,11 +135,6 @@ class phpbb_search_fulltext_sphinx
$this->db = $db;
$this->auth = $auth;
- if (!class_exists('phpbb_db_tools'))
- {
- require($this->phpbb_root_path . 'includes/db/db_tools.' . $this->php_ext);
- }
-
// Initialize phpbb_db_tools object
$this->db_tools = new phpbb_db_tools($this->db);
@@ -274,6 +269,7 @@ class phpbb_search_fulltext_sphinx
p.forum_id,
p.topic_id,
p.poster_id,
+ p.post_visibility,
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post,
p.post_time,
p.post_subject,
@@ -291,6 +287,7 @@ class phpbb_search_fulltext_sphinx
array('sql_attr_uint', 'forum_id'),
array('sql_attr_uint', 'topic_id'),
array('sql_attr_uint', 'poster_id'),
+ array('sql_attr_uint', 'post_visibility'),
array('sql_attr_bool', 'topic_first_post'),
array('sql_attr_bool', 'deleted'),
array('sql_attr_timestamp' , 'post_time'),
@@ -306,6 +303,7 @@ class phpbb_search_fulltext_sphinx
p.forum_id,
p.topic_id,
p.poster_id,
+ p.post_visibility,
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post,
p.post_time,
p.post_subject,
@@ -445,7 +443,7 @@ class phpbb_search_fulltext_sphinx
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -454,7 +452,7 @@ class phpbb_search_fulltext_sphinx
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
- public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
+ public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
{
// No keywords? No posts.
if (!strlen($this->search_query) && !sizeof($author_ary))
@@ -569,6 +567,11 @@ class phpbb_search_fulltext_sphinx
$this->sphinx->SetFilter('poster_id', $author_ary);
}
+ // As this is not simply possible at the moment, we limit the result to approved posts.
+ // This will make it impossible for moderators to search unapproved and softdeleted posts,
+ // but at least it will also cause the same for normal users.
+ $this->sphinx->SetFilter('post_visibility', array(ITEM_APPROVED));
+
if (sizeof($ex_fid_ary))
{
// All forums that a user is allowed to access
@@ -663,7 +666,7 @@ class phpbb_search_fulltext_sphinx
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
- * @param array $m_approve_fid_ary specifies an array of forum ids in which the searcher is allowed to view unapproved posts
+ * @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
@@ -672,14 +675,14 @@ class phpbb_search_fulltext_sphinx
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
- public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page)
+ public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page)
{
$this->search_query = '';
$this->sphinx->SetMatchMode(SPH_MATCH_FULLSCAN);
$fields = ($firstpost_only) ? 'firstpost' : 'all';
$terms = 'all';
- return $this->keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page);
+ return $this->keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page);
}
/**
diff --git a/phpBB/includes/search/index.htm b/phpBB/phpbb/search/index.htm
index ee1f723a7d..ee1f723a7d 100644
--- a/phpBB/includes/search/index.htm
+++ b/phpBB/phpbb/search/index.htm
diff --git a/phpBB/includes/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php
index f1864f0c8c..f1864f0c8c 100644
--- a/phpBB/includes/search/sphinx/config.php
+++ b/phpBB/phpbb/search/sphinx/config.php
diff --git a/phpBB/includes/search/sphinx/config_comment.php b/phpBB/phpbb/search/sphinx/config_comment.php
index 7f695dbf0c..7f695dbf0c 100644
--- a/phpBB/includes/search/sphinx/config_comment.php
+++ b/phpBB/phpbb/search/sphinx/config_comment.php
diff --git a/phpBB/includes/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php
index 79c9c8563d..79c9c8563d 100644
--- a/phpBB/includes/search/sphinx/config_section.php
+++ b/phpBB/phpbb/search/sphinx/config_section.php
diff --git a/phpBB/includes/search/sphinx/config_variable.php b/phpBB/phpbb/search/sphinx/config_variable.php
index 2c1d35a49c..2c1d35a49c 100644
--- a/phpBB/includes/search/sphinx/config_variable.php
+++ b/phpBB/phpbb/search/sphinx/config_variable.php
diff --git a/phpBB/includes/session.php b/phpBB/phpbb/session.php
index 66bf053f7d..dc33786666 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/phpbb/session.php
@@ -404,6 +404,12 @@ class phpbb_session
$method = basename(trim($config['auth_method']));
$provider = $phpbb_container->get('auth.provider.' . $method);
+
+ if (!($provider instanceof phpbb_auth_provider_interface))
+ {
+ throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_interface');
+ }
+
$ret = $provider->validate_session($this->data);
if ($ret !== null && !$ret)
{
@@ -1016,7 +1022,8 @@ class phpbb_session
{
include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx);
}
- phpbb_captcha_factory::garbage_collect($config['captcha_plugin']);
+ $captcha_factory = new phpbb_captcha_factory();
+ $captcha_factory->garbage_collect($config['captcha_plugin']);
$sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . '
WHERE attempt_time < ' . (time() - (int) $config['ip_login_limit_time']);
diff --git a/phpBB/includes/style/extension_path_provider.php b/phpBB/phpbb/style/extension_path_provider.php
index ec1d85f821..ec1d85f821 100644
--- a/phpBB/includes/style/extension_path_provider.php
+++ b/phpBB/phpbb/style/extension_path_provider.php
diff --git a/phpBB/includes/style/path_provider.php b/phpBB/phpbb/style/path_provider.php
index 731d682e88..731d682e88 100644
--- a/phpBB/includes/style/path_provider.php
+++ b/phpBB/phpbb/style/path_provider.php
diff --git a/phpBB/includes/style/path_provider_interface.php b/phpBB/phpbb/style/path_provider_interface.php
index 1a6153a4d3..1a6153a4d3 100644
--- a/phpBB/includes/style/path_provider_interface.php
+++ b/phpBB/phpbb/style/path_provider_interface.php
diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/phpbb/style/resource_locator.php
index 4cf767c062..4cf767c062 100644
--- a/phpBB/includes/style/resource_locator.php
+++ b/phpBB/phpbb/style/resource_locator.php
diff --git a/phpBB/includes/style/style.php b/phpBB/phpbb/style/style.php
index 034f518091..034f518091 100644
--- a/phpBB/includes/style/style.php
+++ b/phpBB/phpbb/style/style.php
diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php
new file mode 100644
index 0000000000..7c322cd971
--- /dev/null
+++ b/phpBB/phpbb/template/asset.php
@@ -0,0 +1,182 @@
+<?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 phpbb_template_asset
+{
+ protected $components = array();
+
+ /**
+ * Constructor
+ *
+ * @param string $url URL
+ */
+ public function __construct($url)
+ {
+ $this->set_url($url);
+ }
+
+ /**
+ * Set URL
+ *
+ * @param string $url URL
+ */
+ public function set_url($url)
+ {
+ if (version_compare(PHP_VERSION, '5.4.7') < 0 && substr($url, 0, 2) === '//')
+ {
+ // Workaround for PHP 5.4.6 and older bug #62844 - add fake scheme and then remove it
+ $this->components = parse_url('http:' . $url);
+ $this->components['scheme'] = '';
+ return;
+ }
+ $this->components = parse_url($url);
+ }
+
+ /**
+ * Convert URL components into string
+ *
+ * @param array $components URL components
+ * @return string URL
+ */
+ protected function join_url($components)
+ {
+ $path = '';
+ if (isset($components['scheme']))
+ {
+ $path = $components['scheme'] === '' ? '//' : $components['scheme'] . '://';
+ }
+
+ if (isset($components['user']) || isset($components['pass']))
+ {
+ if ($path === '' && !isset($components['port']))
+ {
+ $path = '//';
+ }
+ $path .= $components['user'];
+ if (isset($components['pass']))
+ {
+ $path .= ':' . $components['pass'];
+ }
+ $path .= '@';
+ }
+
+ if (isset($components['host']))
+ {
+ if ($path === '' && !isset($components['port']))
+ {
+ $path = '//';
+ }
+ $path .= $components['host'];
+ if (isset($components['port']))
+ {
+ $path .= ':' . $components['port'];
+ }
+ }
+
+ if (isset($components['path']))
+ {
+ $path .= $components['path'];
+ }
+
+ if (isset($components['query']))
+ {
+ $path .= '?' . $components['query'];
+ }
+
+ if (isset($components['fragment']))
+ {
+ $path .= '#' . $components['fragment'];
+ }
+
+ return $path;
+ }
+
+ /**
+ * Get URL
+ *
+ * @return string URL
+ */
+ public function get_url()
+ {
+ return $this->join_url($this->components);
+ }
+
+ /**
+ * Checks if URL is local and relative
+ *
+ * @return boolean True if URL is local and relative
+ */
+ public function is_relative()
+ {
+ if (empty($this->components) || !isset($this->components['path']))
+ {
+ // Invalid URL
+ return false;
+ }
+ return !isset($this->components['scheme']) && !isset($this->components['host']) && substr($this->components['path'], 0, 1) !== '/';
+ }
+
+ /**
+ * Get path component of current URL
+ *
+ * @return string Path
+ */
+ public function get_path()
+ {
+ return isset($this->components['path']) ? $this->components['path'] : '';
+ }
+
+ /**
+ * Set path component
+ *
+ * @param string $path Path component
+ * @param boolean $urlencode If true, parts of path should be encoded with rawurlencode()
+ */
+ public function set_path($path, $urlencode = false)
+ {
+ if ($urlencode)
+ {
+ $paths = explode('/', $path);
+ foreach ($paths as &$dir)
+ {
+ $dir = rawurlencode($dir);
+ }
+ $path = implode('/', $paths);
+ }
+ $this->components['path'] = $path;
+ }
+
+ /**
+ * Add assets_version parameter to URL.
+ * Parameter will not be added if assets_version already exists in URL
+ *
+ * @param string $version Version
+ */
+ public function add_assets_version($version)
+ {
+ if (!isset($this->components['query']))
+ {
+ $this->components['query'] = 'assets_version=' . $version;
+ return;
+ }
+ $query = $this->components['query'];
+ if (!preg_match('/(^|[&;])assets_version=/', $query))
+ {
+ $this->components['query'] = $query . '&amp;assets_version=' . $version;
+ }
+ }
+}
diff --git a/phpBB/includes/template/context.php b/phpBB/phpbb/template/context.php
index c5ce7422b9..c5ce7422b9 100644
--- a/phpBB/includes/template/context.php
+++ b/phpBB/phpbb/template/context.php
diff --git a/phpBB/includes/template/locator.php b/phpBB/phpbb/template/locator.php
index f6fd20bcc2..f6fd20bcc2 100644
--- a/phpBB/includes/template/locator.php
+++ b/phpBB/phpbb/template/locator.php
diff --git a/phpBB/includes/template/template.php b/phpBB/phpbb/template/template.php
index 89a01e924d..89a01e924d 100644
--- a/phpBB/includes/template/template.php
+++ b/phpBB/phpbb/template/template.php
diff --git a/phpBB/includes/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php
index 6557b209eb..6557b209eb 100644
--- a/phpBB/includes/template/twig/definition.php
+++ b/phpBB/phpbb/template/twig/definition.php
diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php
index b60cd72325..b60cd72325 100644
--- a/phpBB/includes/template/twig/environment.php
+++ b/phpBB/phpbb/template/twig/environment.php
diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php
index c279726434..c279726434 100644
--- a/phpBB/includes/template/twig/extension.php
+++ b/phpBB/phpbb/template/twig/extension.php
diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index 46412ad048..4f88147542 100644
--- a/phpBB/includes/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -126,10 +126,14 @@ class phpbb_template_twig_lexer extends Twig_Lexer
{
$callback = function($matches)
{
- // Remove any quotes that may have been used in different implementations
- // E.g. DEFINE $TEST = 'blah' vs INCLUDE foo
- // Replace {} with start/end to parse variables (' ~ TEST ~ '.html)
- $matches[2] = str_replace(array('"', "'", '{', '}'), array('', '', "' ~ ", " ~ '"), $matches[2]);
+ // Remove matching quotes at the beginning/end if a statement;
+ // E.g. 'asdf'"' -> asdf'"
+ // E.g. "asdf'"" -> asdf'"
+ // E.g. 'asdf'" -> 'asdf'"
+ $matches[2] = preg_replace('#^([\'"])?(.+?)\1$#', '$2', $matches[2]);
+
+ // Replace template variables with start/end to parse variables (' ~ TEST ~ '.html)
+ $matches[2] = preg_replace('#{([a-zA-Z0-9_\.$]+)}#', "'~ \$1 ~'", $matches[2]);
// Surround the matches in single quotes ('' ~ TEST ~ '.html')
return "<!-- {$matches[1]} '{$matches[2]}' -->";
@@ -219,19 +223,20 @@ class phpbb_template_twig_lexer extends Twig_Lexer
{
$callback = function($matches)
{
+ $inner = $matches[2];
// Replace $TEST with definition.TEST
- $matches[1] = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $matches[1]);
+ $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner);
// Replace .test with test|length
- $matches[1] = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $matches[1]);
+ $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $inner);
- return '<!-- IF' . $matches[1] . '-->';
+ return "<!-- {$matches[1]}IF{$inner}-->";
};
// Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces)
$code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code);
- return preg_replace_callback('#<!-- IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code);
+ return preg_replace_callback('#<!-- (ELSE)?IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code);
}
/**
diff --git a/phpBB/includes/template/twig/node/define.php b/phpBB/phpbb/template/twig/node/define.php
index fcb19cc773..fcb19cc773 100644
--- a/phpBB/includes/template/twig/node/define.php
+++ b/phpBB/phpbb/template/twig/node/define.php
diff --git a/phpBB/includes/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php
index 971dea14fa..971dea14fa 100644
--- a/phpBB/includes/template/twig/node/event.php
+++ b/phpBB/phpbb/template/twig/node/event.php
diff --git a/phpBB/includes/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
index 8ec2069114..8ec2069114 100644
--- a/phpBB/includes/template/twig/node/expression/binary/equalequal.php
+++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
diff --git a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
index 96f32c502e..96f32c502e 100644
--- a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php
+++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
diff --git a/phpBB/includes/template/twig/node/include.php b/phpBB/phpbb/template/twig/node/include.php
index 5c6ae1bbcf..5c6ae1bbcf 100644
--- a/phpBB/includes/template/twig/node/include.php
+++ b/phpBB/phpbb/template/twig/node/include.php
diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php
index b12d379157..1cab416c79 100644
--- a/phpBB/includes/template/twig/node/includeasset.php
+++ b/phpBB/phpbb/template/twig/node/includeasset.php
@@ -33,26 +33,21 @@ abstract class phpbb_template_twig_node_includeasset extends Twig_Node
->write("\$asset_file = ")
->subcompile($this->getNode('expr'))
->raw(";\n")
- ->write("\$argument_string = \$anchor_string = '';\n")
- ->write("if ((\$argument_string_start = strpos(\$asset_file, '?')) !== false) {\n")
+ ->write("\$asset = new phpbb_template_asset(\$asset_file);\n")
+ ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n")
->indent()
- ->write("\$argument_string = substr(\$asset_file, \$argument_string_start);\n")
- ->write("\$asset_file = substr(\$asset_file, 0, \$argument_string_start);\n")
- ->write("if ((\$anchor_string_start = strpos(\$argument_string, '#')) !== false) {\n")
+ ->write("\$asset_path = \$asset->get_path();")
+ ->write("\$local_file = \$this->getEnvironment()->get_phpbb_root_path() . \$asset_path;\n")
+ ->write("if (!file_exists(\$local_file)) {\n")
->indent()
- ->write("\$anchor_string = substr(\$argument_string, \$anchor_string_start);\n")
- ->write("\$argument_string = substr(\$argument_string, 0, \$anchor_string_start);\n")
+ ->write("\$local_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$asset_path);\n")
+ ->write("\$asset->set_path(\$local_file, true);\n")
->outdent()
+ ->write("\$asset->add_assets_version({$config['assets_version']});\n")
+ ->write("\$asset_file = \$asset->get_url();\n")
->write("}\n")
->outdent()
->write("}\n")
- ->write("if (strpos(\$asset_file, '//') !== 0 && strpos(\$asset_file, 'http://') !== 0 && strpos(\$asset_file, 'https://') !== 0 && !file_exists(\$asset_file)) {\n")
- ->indent()
- ->write("\$asset_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$asset_file);\n")
- ->write("\$argument_string .= ((\$argument_string) ? '&' : '?') . 'assets_version={$config['assets_version']}';\n")
- ->outdent()
- ->write("}\n")
- ->write("\$asset_file .= \$argument_string . \$anchor_string;\n")
->write("\$context['definition']->append('{$this->get_definition_name()}', '")
;
diff --git a/phpBB/includes/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php
index 450edb3e1e..450edb3e1e 100644
--- a/phpBB/includes/template/twig/node/includecss.php
+++ b/phpBB/phpbb/template/twig/node/includecss.php
diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php
index 50ab448e0f..50ab448e0f 100644
--- a/phpBB/includes/template/twig/node/includejs.php
+++ b/phpBB/phpbb/template/twig/node/includejs.php
diff --git a/phpBB/includes/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php
index dbe54f0e1a..dbe54f0e1a 100644
--- a/phpBB/includes/template/twig/node/includephp.php
+++ b/phpBB/phpbb/template/twig/node/includephp.php
diff --git a/phpBB/includes/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php
index c11539ea7f..c11539ea7f 100644
--- a/phpBB/includes/template/twig/node/php.php
+++ b/phpBB/phpbb/template/twig/node/php.php
diff --git a/phpBB/includes/template/twig/tokenparser/define.php b/phpBB/phpbb/template/twig/tokenparser/define.php
index 4ea15388c4..4ea15388c4 100644
--- a/phpBB/includes/template/twig/tokenparser/define.php
+++ b/phpBB/phpbb/template/twig/tokenparser/define.php
diff --git a/phpBB/includes/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php
index e4dddd6dcc..e4dddd6dcc 100644
--- a/phpBB/includes/template/twig/tokenparser/event.php
+++ b/phpBB/phpbb/template/twig/tokenparser/event.php
diff --git a/phpBB/includes/template/twig/tokenparser/include.php b/phpBB/phpbb/template/twig/tokenparser/include.php
index 520f9fd1a0..520f9fd1a0 100644
--- a/phpBB/includes/template/twig/tokenparser/include.php
+++ b/phpBB/phpbb/template/twig/tokenparser/include.php
diff --git a/phpBB/includes/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php
index 6c24dda647..6c24dda647 100644
--- a/phpBB/includes/template/twig/tokenparser/includecss.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php
diff --git a/phpBB/includes/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php
index b02b2f89ba..b02b2f89ba 100644
--- a/phpBB/includes/template/twig/tokenparser/includejs.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php
diff --git a/phpBB/includes/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php
index 13fe6de8a6..13fe6de8a6 100644
--- a/phpBB/includes/template/twig/tokenparser/includephp.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php
diff --git a/phpBB/includes/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php
index 197980a59a..197980a59a 100644
--- a/phpBB/includes/template/twig/tokenparser/php.php
+++ b/phpBB/phpbb/template/twig/tokenparser/php.php
diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php
index f5638972a3..92a37d1634 100644
--- a/phpBB/includes/template/twig/twig.php
+++ b/phpBB/phpbb/template/twig/twig.php
@@ -172,7 +172,7 @@ class phpbb_template_twig implements phpbb_template
*/
public function set_filenames(array $filename_array)
{
- $this->filenames = array_merge($filename_array, $this->filenames);
+ $this->filenames = array_merge($this->filenames, $filename_array);
return $this;
}
diff --git a/phpBB/includes/tree/interface.php b/phpBB/phpbb/tree/interface.php
index cc8aab2115..cc8aab2115 100644
--- a/phpBB/includes/tree/interface.php
+++ b/phpBB/phpbb/tree/interface.php
diff --git a/phpBB/includes/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php
index 4d851a87a8..4d851a87a8 100644
--- a/phpBB/includes/tree/nestedset.php
+++ b/phpBB/phpbb/tree/nestedset.php
diff --git a/phpBB/includes/tree/nestedset_forum.php b/phpBB/phpbb/tree/nestedset_forum.php
index ff09ef55d0..ff09ef55d0 100644
--- a/phpBB/includes/tree/nestedset_forum.php
+++ b/phpBB/phpbb/tree/nestedset_forum.php
diff --git a/phpBB/includes/user.php b/phpBB/phpbb/user.php
index 5530fe3f03..5530fe3f03 100644
--- a/phpBB/includes/user.php
+++ b/phpBB/phpbb/user.php
diff --git a/phpBB/includes/user_loader.php b/phpBB/phpbb/user_loader.php
index 37bf9648c1..37bf9648c1 100644
--- a/phpBB/includes/user_loader.php
+++ b/phpBB/phpbb/user_loader.php
diff --git a/phpBB/posting.php b/phpBB/posting.php
index c6b9ff4cce..ac459197b3 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -35,11 +35,17 @@ $submit = (isset($_POST['post'])) ? true : false;
$preview = (isset($_POST['preview'])) ? true : false;
$save = (isset($_POST['save'])) ? true : false;
$load = (isset($_POST['load'])) ? true : false;
-$delete = (isset($_POST['delete'])) ? true : false;
+$confirm = $request->is_set_post('confirm');
$cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false;
-$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview) ? true : false;
-$mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var('mode', '');
+$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview);
+$mode = request_var('mode', '');
+
+// If the user is not allowed to delete the post, we try to soft delete it, so we overwrite the mode here.
+if ($mode == 'delete' && (($confirm && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)))
+{
+ $mode = 'soft_delete';
+}
$error = $post_data = array();
$current_time = time();
@@ -92,6 +98,8 @@ if (in_array($mode, array('post', 'reply', 'quote', 'edit', 'delete')) && !$foru
trigger_error('NO_FORUM');
}
+$phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
// We need to know some basic information in all cases before we do anything.
switch ($mode)
{
@@ -121,13 +129,14 @@ switch ($mode)
$sql = 'SELECT f.*, t.*
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
WHERE t.topic_id = $topic_id
- AND f.forum_id = t.forum_id" .
- (($auth->acl_get('m_approve', $forum_id)) ? '' : ' AND t.topic_approved = 1');
+ AND f.forum_id = t.forum_id
+ AND " . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
break;
case 'quote':
case 'edit':
case 'delete':
+ case 'soft_delete':
if (!$post_id)
{
$user->setup('posting');
@@ -149,8 +158,8 @@ switch ($mode)
WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id
AND u.user_id = p.poster_id
- AND f.forum_id = t.forum_id" .
- (($auth->acl_get('m_approve', $forum_id)) ? '' : ' AND p.post_approved = 1');
+ AND f.forum_id = t.forum_id
+ AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.');
break;
case 'smilies':
@@ -198,7 +207,7 @@ if (!$post_data)
// Not able to reply to unapproved posts/topics
// TODO: add more descriptive language key
-if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'bump') && !$post_data['topic_approved']) || ($mode == 'quote' && !$post_data['post_approved'])))
+if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'bump') && $post_data['topic_visibility'] != ITEM_APPROVED) || ($mode == 'quote' && $post_data['post_visibility'] != ITEM_APPROVED)))
{
trigger_error(($mode == 'reply' || $mode == 'bump') ? 'TOPIC_UNAPPROVED' : 'POST_UNAPPROVED');
}
@@ -290,10 +299,22 @@ switch ($mode)
break;
case 'delete':
- if ($user->data['is_registered'] && $auth->acl_gets('f_delete', 'm_delete', $forum_id))
+ if ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id))))
+ {
+ $is_authed = true;
+ }
+ break;
+
+ case 'soft_delete':
+ if ($user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked']))
{
$is_authed = true;
}
+ else
+ {
+ // Display the same error message for softdelete we use for delete
+ $mode = 'delete';
+ }
break;
}
@@ -342,9 +363,17 @@ if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id))
}
// Handle delete mode...
-if ($mode == 'delete')
+if ($mode == 'delete' || $mode == 'soft_delete')
{
- handle_post_delete($forum_id, $topic_id, $post_id, $post_data);
+ if ($mode == 'soft_delete' && $post_data['post_visibility'] == ITEM_DELETED)
+ {
+ $user->setup('posting');
+ trigger_error('NO_POST');
+ }
+
+ $allow_reason = $auth->acl_get('m_softdelete', $forum_id) || ($auth->acl_gets('m_delete', 'f_delete', $forum_id) && $auth->acl_gets('m_softdelete', 'f_softdelete', $forum_id));
+ $soft_delete_reason = ($mode == 'soft_delete' && $allow_reason) ? $request->variable('delete_reason', '', true) : '';
+ handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $soft_delete_reason);
return;
}
@@ -900,6 +929,19 @@ if ($submit || $preview || $refresh)
$error[] = $user->lang['FORM_INVALID'];
}
+ if ($submit && $mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED && !isset($_POST['soft_delete']) && $auth->acl_get('m_approve', $forum_id))
+ {
+ $is_first_post = ($post_id == $post_data['topic_first_post_id'] || !$post_data['topic_posts_approved']);
+ $is_last_post = ($post_id == $post_data['topic_last_post_id'] || !$post_data['topic_posts_approved']);
+ $updated_post_data = $phpbb_content_visibility->set_post_visibility(ITEM_APPROVED, $post_id, $post_data['topic_id'], $post_data['forum_id'], $user->data['user_id'], time(), '', $is_first_post, $is_last_post);
+
+ if (!empty($updated_post_data))
+ {
+ // Update the post_data, so we don't need to refetch it.
+ $post_data = array_merge($post_data, $updated_post_data);
+ }
+ }
+
// Parse subject
if (!$preview && !$refresh && utf8_clean_string($post_data['post_subject']) === '' && ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id)))
{
@@ -1099,14 +1141,15 @@ if ($submit || $preview || $refresh)
'attachment_data' => $message_parser->attachment_data,
'filename_data' => $message_parser->filename_data,
- 'topic_approved' => (isset($post_data['topic_approved'])) ? $post_data['topic_approved'] : false,
- 'post_approved' => (isset($post_data['post_approved'])) ? $post_data['post_approved'] : false,
+ 'topic_visibility' => (isset($post_data['topic_visibility'])) ? $post_data['topic_visibility'] : false,
+ 'post_visibility' => (isset($post_data['post_visibility'])) ? $post_data['post_visibility'] : false,
);
if ($mode == 'edit')
{
- $data['topic_replies_real'] = $post_data['topic_replies_real'];
- $data['topic_replies'] = $post_data['topic_replies'];
+ $data['topic_posts_approved'] = $post_data['topic_posts_approved'];
+ $data['topic_posts_unapproved'] = $post_data['topic_posts_unapproved'];
+ $data['topic_posts_softdeleted'] = $post_data['topic_posts_softdeleted'];
}
// The last parameter tells submit_post if search indexer has to be run
@@ -1117,6 +1160,15 @@ if ($submit || $preview || $refresh)
$captcha->reset();
}
+ // Handle delete mode...
+ if ($request->is_set_post('delete') || $request->is_set_post('delete_permanent'))
+ {
+ $allow_reason = $auth->acl_get('m_softdelete', $forum_id) || ($auth->acl_gets('m_delete', 'f_delete', $forum_id) && $auth->acl_gets('m_softdelete', 'f_softdelete', $forum_id));
+ $soft_delete_reason = (!$request->is_set_post('delete_permanent') && $allow_reason) ? $request->variable('delete_reason', '', true) : '';
+ handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $soft_delete_reason);
+ return;
+ }
+
// Check the permissions for post approval.
// Moderators must go through post approval like ordinary users.
if ((!$auth->acl_get('f_noapprove', $data['forum_id']) && empty($data['force_approved_state'])) || (isset($data['force_approved_state']) && !$data['force_approved_state']))
@@ -1438,6 +1490,11 @@ $template->assign_vars(array(
'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '',
'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false,
'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '',
+ 'S_SOFTDELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '',
+ 'S_DELETE_REASON' => ($mode == 'edit' && $auth->acl_get('m_softdelete', $forum_id)) ? true : false,
+ 'S_SOFTDELETE_ALLOWED' => ($mode == 'edit' && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false,
+ 'S_RESTORE_ALLOWED' => $auth->acl_get('m_approve', $forum_id),
+ 'S_IS_DELETED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? true : false,
'S_LINKS_ALLOWED' => $url_status,
'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '',
'S_TYPE_TOGGLE' => $topic_type_toggle,
@@ -1539,18 +1596,20 @@ function upload_popup($forum_style = 0)
/**
* Do the various checks required for removing posts as well as removing it
*/
-function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data)
+function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $soft_delete_reason = '')
{
global $user, $db, $auth, $config;
global $phpbb_root_path, $phpEx;
+ $perm_check = ($is_soft) ? 'softdelete' : 'delete';
+
// If moderator removing post or user itself removing post, present a confirmation screen
- if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])))
+ if ($auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])))
{
- $s_hidden_fields = build_hidden_fields(array(
+ $s_hidden_fields = array(
'p' => $post_id,
'f' => $forum_id,
- 'mode' => 'delete')
+ 'mode' => ($is_soft) ? 'soft_delete' : 'delete',
);
if (confirm_box(true))
@@ -1558,29 +1617,31 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data)
$data = array(
'topic_first_post_id' => $post_data['topic_first_post_id'],
'topic_last_post_id' => $post_data['topic_last_post_id'],
- 'topic_replies_real' => $post_data['topic_replies_real'],
- 'topic_approved' => $post_data['topic_approved'],
+ 'topic_posts_approved' => $post_data['topic_posts_approved'],
+ 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'],
+ 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'],
+ 'topic_visibility' => $post_data['topic_visibility'],
'topic_type' => $post_data['topic_type'],
- 'post_approved' => $post_data['post_approved'],
+ 'post_visibility' => $post_data['post_visibility'],
'post_reported' => $post_data['post_reported'],
'post_time' => $post_data['post_time'],
'poster_id' => $post_data['poster_id'],
- 'post_postcount' => $post_data['post_postcount']
+ 'post_postcount' => $post_data['post_postcount'],
);
- $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data);
+ $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $soft_delete_reason);
$post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username'];
if ($next_post_id === false)
{
- add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_TOPIC', $post_data['topic_title'], $post_username);
+ add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username);
$meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id");
$message = $user->lang['POST_DELETED'];
}
else
{
- add_log('mod', $forum_id, $topic_id, 'LOG_DELETE_POST', $post_data['post_subject'], $post_username);
+ add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username);
$meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p=$next_post_id") . "#p$next_post_id";
$message = $user->lang['POST_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $meta_info . '">', '</a>');
@@ -1592,7 +1653,32 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data)
}
else
{
- confirm_box(false, 'DELETE_POST', $s_hidden_fields);
+ global $user, $template, $request;
+
+ $can_delete = $auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id));
+ $can_softdelete = $auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id));
+ $display_reason = $auth->acl_get('m_softdelete', $forum_id) || ($can_delete && $can_softdelete);
+
+ $template->assign_vars(array(
+ 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED,
+ 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '',
+ 'S_ALLOWED_DELETE' => $can_delete,
+ 'S_ALLOWED_SOFTDELETE' => $can_softdelete,
+ 'S_DELETE_REASON' => $display_reason,
+ ));
+
+ $l_confirm = 'DELETE_POST';
+ if ($post_data['post_visibility'] == ITEM_DELETED)
+ {
+ $l_confirm .= '_PERMANENTLY';
+ $s_hidden_fields['delete_permanent'] = '1';
+ }
+ else if (!$can_softdelete)
+ {
+ $s_hidden_fields['delete_permanent'] = '1';
+ }
+
+ confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html');
}
}
diff --git a/phpBB/report.php b/phpBB/report.php
index 3f2e7a91ff..c9ca57ecbe 100644
--- a/phpBB/report.php
+++ b/phpBB/report.php
@@ -147,7 +147,7 @@ else
if ($config['enable_post_confirm'] && !$user->data['is_registered'])
{
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
- $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_REPORT);
}
@@ -157,10 +157,13 @@ $s_hidden_fields = '';
// Submit report?
if ($submit && $reason_id)
{
- $visual_confirmation_response = $captcha->validate();
- if ($visual_confirmation_response)
+ if (isset($captcha))
{
- $error[] = $visual_confirmation_response;
+ $visual_confirmation_response = $captcha->validate();
+ if ($visual_confirmation_response)
+ {
+ $error[] = $visual_confirmation_response;
+ }
}
$sql = 'SELECT *
diff --git a/phpBB/search.php b/phpBB/search.php
index 7d20d8d4a2..8bcbfc498b 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -119,6 +119,8 @@ $sort_by_text = array('a' => $user->lang['SORT_AUTHOR'], 't' => $user->lang['SOR
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
+$phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
if ($keywords || $author || $author_id || $search_id || $submit)
{
// clear arrays
@@ -249,22 +251,9 @@ if ($keywords || $author || $author_id || $search_id || $submit)
}
$db->sql_freeresult($result);
- // find out in which forums the user is allowed to view approved posts
- if ($auth->acl_get('m_approve'))
- {
- $m_approve_fid_ary = array(-1);
- $m_approve_fid_sql = '';
- }
- else if ($auth->acl_getf_global('m_approve'))
- {
- $m_approve_fid_ary = array_diff(array_keys($auth->acl_getf('!m_approve', true)), $ex_fid_ary);
- $m_approve_fid_sql = ' AND (p.post_approved = 1' . ((sizeof($m_approve_fid_ary)) ? ' OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')';
- }
- else
- {
- $m_approve_fid_ary = array();
- $m_approve_fid_sql = ' AND p.post_approved = 1';
- }
+ // find out in which forums the user is allowed to view posts
+ $m_approve_posts_fid_sql = $phpbb_content_visibility->get_global_visibility_sql('post', $ex_fid_ary, 'p.');
+ $m_approve_topics_fid_sql = $phpbb_content_visibility->get_global_visibility_sql('topic', $ex_fid_ary, 't.');
if ($reset_search_forum)
{
@@ -342,7 +331,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
FROM ' . TOPICS_TABLE . " t
WHERE t.topic_moved_id = 0
$last_post_time_sql
- " . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
+ AND " . $m_approve_topics_fid_sql . '
' . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . '
ORDER BY t.topic_last_post_time DESC';
$field = 'topic_id';
@@ -377,10 +366,10 @@ if ($keywords || $author || $author_id || $search_id || $submit)
{
$sql = "SELECT p.post_id
FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
- WHERE t.topic_replies = 0
+ WHERE t.topic_posts_approved = 1
AND p.topic_id = t.topic_id
$last_post_time
- $m_approve_fid_sql
+ AND $m_approve_posts_fid_sql
" . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
$sql_sort";
$field = 'post_id';
@@ -389,11 +378,11 @@ if ($keywords || $author || $author_id || $search_id || $submit)
{
$sql = 'SELECT DISTINCT ' . $sort_by_sql[$sort_key] . ", p.topic_id
FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
- WHERE t.topic_replies = 0
+ WHERE t.topic_posts_approved = 1
AND t.topic_moved_id = 0
AND p.topic_id = t.topic_id
$last_post_time
- $m_approve_fid_sql
+ AND $m_approve_topics_fid_sql
" . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
$sql_sort";
$field = 'topic_id';
@@ -409,7 +398,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
$sql_where = 'AND t.topic_moved_id = 0
- ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
+ AND ' . $m_approve_topics_fid_sql . '
' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
@@ -432,9 +421,9 @@ if ($keywords || $author || $author_id || $search_id || $submit)
{
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p
- WHERE p.post_time > ' . $user->data['user_lastvisit'] . "
- $m_approve_fid_sql
- " . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
+ WHERE p.post_time > ' . $user->data['user_lastvisit'] . '
+ AND ' . $m_approve_posts_fid_sql . '
+ ' . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
$sql_sort";
$field = 'post_id';
}
@@ -444,7 +433,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
FROM ' . TOPICS_TABLE . ' t
WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . '
AND t.topic_moved_id = 0
- ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
+ AND ' . $m_approve_topics_fid_sql . '
' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . "
$sql_sort";
/*
@@ -456,8 +445,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
WHERE p.post_time > ' . $user->data['user_lastvisit'] . '
AND t.topic_id = p.topic_id
AND t.topic_moved_id = 0
- ' . $m_approve_fid_sql . '
- ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . "
+ AND ' . $m_approve_topics_fid_sql . "
GROUP BY t.topic_id
$sql_sort";
*/
@@ -533,17 +521,16 @@ if ($keywords || $author || $author_id || $search_id || $submit)
// make sure that some arrays are always in the same order
sort($ex_fid_ary);
- sort($m_approve_fid_ary);
sort($author_id_ary);
if ($search->get_search_query())
{
- $total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
+ $total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
}
else if (sizeof($author_id_ary))
{
$firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false;
- $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
+ $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
}
// For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options.
@@ -558,7 +545,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
{
$sql_where .= $db->sql_in_set(($show_results == 'posts') ? 'p.post_id' : 't.topic_id', $id_ary);
$sql_where .= (sizeof($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : '';
- $sql_where .= ($show_results == 'posts') ? $m_approve_fid_sql : str_replace(array('p.post_approved', 'p.forum_id'), array('t.topic_approved', 't.forum_id'), $m_approve_fid_sql);
+ $sql_where .= ' AND ' . (($show_results == 'posts') ? $m_approve_posts_fid_sql : $m_approve_topics_fid_sql);
}
if ($show_results == 'posts')
@@ -638,6 +625,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'),
+ 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'),
'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
'U_SEARCH_WORDS' => $u_search,
@@ -874,12 +862,11 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$forum_id = $row['forum_id'];
$result_topic_id = $row['topic_id'];
$topic_title = censor_text($row['topic_title']);
+ $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
$view_topic_url_params = "f=$forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : '');
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
- $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
-
if ($show_results == 'topics')
{
if ($config['load_db_track'] && $author_id === $user->data['user_id'])
@@ -892,9 +879,11 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false;
- $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
- $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
+ $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $forum_id)) ? true : false;
+ $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
+ $topic_deleted = $row['topic_visibility'] == ITEM_DELETED;
$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&amp;t=$result_topic_id", true, $user->session_id) : '';
+ $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&amp;mode=deleted_topics&amp;t=$result_topic_id", true, $user->session_id) : '';
$row['topic_title'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#is', '<span class="posthilit">$1</span>', $row['topic_title']);
@@ -929,6 +918,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false,
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
'S_POSTS_UNAPPROVED' => $posts_unapproved,
+ 'S_TOPIC_DELETED' => $topic_deleted,
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 2528b96ece..394aca749b 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -126,11 +126,19 @@ phpbb.addAjaxCallback('post_delete', function() {
});
// This callback removes the approve / disapprove div or link.
-phpbb.addAjaxCallback('post_approve', function(res) {
- var remove = (res.approved) ? $(this) : $(this).parents('.post');
+phpbb.addAjaxCallback('post_visibility', function(res) {
+ var remove = (res.visible) ? $(this) : $(this).parents('.post');
$(remove).css('pointer-events', 'none').fadeOut(function() {
$(this).remove();
});
+
+ if (res.visible)
+ {
+ // Remove the "Deleted by" message from the post on restoring.
+ remove.parents('.post').find('.post_deleted_msg').css('pointer-events', 'none').fadeOut(function() {
+ $(this).remove();
+ });
+ }
});
// This removes the parent row of the link or form that fired the callback.
@@ -178,6 +186,20 @@ $('#qr_full_editor').click(function() {
});
+/**
+ * Make the display post links to use JS
+ */
+$('.display_post').click(function(e) {
+ // Do not follow the link
+ e.preventDefault();
+
+ var post_id = $(this).attr('data-post-id');
+ $('#post_content' + post_id).show();
+ $('#profile' + post_id).show();
+ $('#post_hidden' + post_id).hide();
+});
+
+
/**
* This AJAXifies the quick-mod tools. The reason it cannot be a standard
@@ -208,6 +230,14 @@ $('#quick-mod-select').change(function () {
$('#quickmodform').submit();
});
+$('#delete_permanent').click(function () {
+ if ($(this).attr('checked')) {
+ $('#delete_reason').hide();
+ } else {
+ $('#delete_reason').show();
+ }
+});
+
/**
* Toggle the member search panel in memberlist.php.
*
diff --git a/phpBB/styles/prosilver/template/confirm_delete_body.html b/phpBB/styles/prosilver/template/confirm_delete_body.html
new file mode 100644
index 0000000000..759b6b46b2
--- /dev/null
+++ b/phpBB/styles/prosilver/template/confirm_delete_body.html
@@ -0,0 +1,72 @@
+<!-- IF S_AJAX_REQUEST -->
+ <p>{MESSAGE_TEXT}</p>
+
+ <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) -->
+ <!-- IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
+ <label>
+ <strong>{L_DELETE_PERMANENTLY}{L_COLON}</strong>
+ <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} />
+ <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF -->
+ </label>
+ <!-- ENDIF -->
+
+ <!-- IF S_DELETE_REASON -->
+ <label for="delete_reason">
+ <strong>{L_DELETE_REASON}{L_COLON}</strong><br /><span>{L_DELETE_REASON_EXPLAIN}</span><br />
+ <input type="text" name="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" />
+ </label>
+ <!-- ENDIF -->
+ <!-- ENDIF -->
+
+ <fieldset class="submit-buttons">
+ <input type="button" name="confirm" value="{L_YES}" class="button1" />&nbsp;
+ <input type="button" name="cancel" value="{L_NO}" class="button2" />
+ </fieldset>
+
+<!-- ELSE -->
+
+<!-- INCLUDE overall_header.html -->
+
+<form id="confirm" action="{S_CONFIRM_ACTION}" method="post">
+<div class="panel">
+ <div class="inner">
+
+ <h2>{MESSAGE_TITLE}</h2>
+
+ <p>{MESSAGE_TEXT}</p>
+
+ <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) -->
+ <fieldset class="fields1">
+ <!-- IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
+ <dl>
+ <dt><label for="delete_permanent">{L_DELETE_PERMANENTLY}{L_COLON}</label></dt>
+ <dd>
+ <label for="delete_permanent">
+ <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} />
+ <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF -->
+ </label>
+ </dd>
+ </dl>
+ <!-- ENDIF -->
+
+ <!-- IF S_DELETE_REASON -->
+ <dl>
+ <dt><label for="delete_reason">{L_DELETE_REASON}{L_COLON}</label><br /><span>{L_DELETE_REASON_EXPLAIN}</span></dt>
+ <dd><input type="text" name="delete_reason" id="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></dd>
+ </dl>
+ <!-- ENDIF -->
+ </fieldset>
+ <!-- ENDIF -->
+
+ <fieldset class="submit-buttons">
+ {S_HIDDEN_FIELDS}
+ <input type="submit" name="confirm" value="{L_YES}" class="button1" />&nbsp;
+ <input type="submit" name="cancel" value="{L_NO}" class="button2" />
+ </fieldset>
+
+ </div>
+</div>
+</form>
+
+<!-- INCLUDE overall_footer.html -->
+<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js
index 235cc0025b..4c70ee345f 100644
--- a/phpBB/styles/prosilver/template/editor.js
+++ b/phpBB/styles/prosilver/template/editor.js
@@ -301,7 +301,7 @@ function colorPalette(dir, width, height) {
var r = 0,
g = 0,
b = 0,
- numberList = new Array(6);
+ numberList = new Array(6),
color = '',
html = '';
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js
index bb29f00490..eccb12e827 100644
--- a/phpBB/styles/prosilver/template/forum_fn.js
+++ b/phpBB/styles/prosilver/template/forum_fn.js
@@ -106,32 +106,51 @@ function dE(n, s, type) {
/**
* Alternate display of subPanels
*/
-function subPanels(p) {
- var i, e, t;
+jQuery(document).ready(function() {
+ jQuery('.sub-panels').each(function() {
+
+ var panels = [],
+ childNodes = jQuery('a[data-subpanel]', this).each(function() {
+ panels.push(this.getAttribute('data-subpanel'));
+ }),
+ show_panel = this.getAttribute('data-show-panel');
+
+ if (panels.length) {
+ subPanels(show_panel);
+ childNodes.click(function () {
+ subPanels(this.getAttribute('data-subpanel'));
+ return false;
+ });
+ }
- if (typeof(p) === 'string') {
- show_panel = p;
- }
+ function subPanels(p) {
+ var i, e, t;
- for (i = 0; i < panels.length; i++) {
- e = document.getElementById(panels[i]);
- t = document.getElementById(panels[i] + '-tab');
+ if (typeof(p) === 'string') {
+ show_panel = p;
+ }
- if (e) {
- if (panels[i] === show_panel) {
- e.style.display = 'block';
- if (t) {
- t.className = 'activetab';
- }
- } else {
- e.style.display = 'none';
- if (t) {
- t.className = '';
+ for (i = 0; i < panels.length; i++) {
+ e = document.getElementById(panels[i]);
+ t = document.getElementById(panels[i] + '-tab');
+
+ if (e) {
+ if (panels[i] === show_panel) {
+ e.style.display = 'block';
+ if (t) {
+ t.className = 'activetab';
+ }
+ } else {
+ e.style.display = 'none';
+ if (t) {
+ t.className = '';
+ }
+ }
}
}
}
- }
-}
+ });
+});
/**
* Call print preview
@@ -385,3 +404,22 @@ function apply_onkeypress_event() {
}
jQuery(document).ready(apply_onkeypress_event);
+
+/**
+* Adjust HTML code for IE8 and older versions
+*/
+(function($) {
+ $(document).ready(function() {
+ var test = document.createElement('div'),
+ oldBrowser = (typeof test.style.borderRadius == 'undefined');
+ delete test;
+
+ if (!oldBrowser) {
+ return;
+ }
+
+ // Fix .linkslist.bulletin lists
+ $('ul.linklist.bulletin li:first-child, ul.linklist.bulletin li.rightside:last-child').addClass('no-bulletin');
+ });
+})(jQuery);
+
diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html
index 0c67de76ec..9fb6b3d951 100644
--- a/phpBB/styles/prosilver/template/forumlist_body.html
+++ b/phpBB/styles/prosilver/template/forumlist_body.html
@@ -50,7 +50,11 @@
<dd class="topics">{forumrow.TOPICS} <dfn>{L_TOPICS}</dfn></dd>
<dd class="posts">{forumrow.POSTS} <dfn>{L_POSTS}</dfn></dd>
<dd class="lastpost"><span>
- <!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a><!-- ENDIF -->
+ <!-- IF forumrow.U_UNAPPROVED_TOPICS -->
+ <a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a>
+ <!-- ELSEIF forumrow.U_UNAPPROVED_POSTS -->
+ <a href="{forumrow.U_UNAPPROVED_POSTS}">{UNAPPROVED_POST_IMG}</a>
+ <!-- ENDIF -->
<!-- IF forumrow.LAST_POST_TIME --><dfn>{L_LAST_POST}</dfn>
<!-- IF forumrow.S_DISPLAY_SUBJECT -->
<!-- EVENT forumlist_body_last_post_title_prepend -->
diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html
index 57ad540a4a..e0a9279738 100644
--- a/phpBB/styles/prosilver/template/index_body.html
+++ b/phpBB/styles/prosilver/template/index_body.html
@@ -4,9 +4,16 @@
<!-- IF U_MCP --><p>{CURRENT_TIME} <br />[&nbsp;<a href="{U_MCP}">{L_MCP}</a>&nbsp;]</p><!-- ELSEIF S_USER_LOGGED_IN --><p>{CURRENT_TIME}</p><!-- ENDIF -->
<!-- IF S_DISPLAY_SEARCH or (S_USER_LOGGED_IN and not S_IS_BOT) -->
-<ul class="linklist">
+<ul class="linklist bulletin">
<!-- IF S_DISPLAY_SEARCH -->
- <li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_LOAD_UNREADS --> &bull; <a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --> &bull; <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> &bull; <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
+ <li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a></li>
+ <!-- IF S_LOAD_UNREADS -->
+ <li><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a></li>
+ <!-- ENDIF -->
+ <!-- IF S_USER_LOGGED_IN -->
+ <li><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a></li>
+ <!-- ENDIF -->
+ <li><a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
<!-- ENDIF -->
<!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m" data-ajax="mark_forums_read" data-overlay="false">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF -->
</ul>
diff --git a/phpBB/styles/prosilver/template/mcp_approve.html b/phpBB/styles/prosilver/template/mcp_approve.html
index 6c8215c7c6..ab7f92e262 100644
--- a/phpBB/styles/prosilver/template/mcp_approve.html
+++ b/phpBB/styles/prosilver/template/mcp_approve.html
@@ -7,7 +7,7 @@
<label><input type="checkbox" name="notify_poster" checked="checked" /> <!-- IF S_APPROVE -->{L_NOTIFY_POSTER_APPROVAL}<!-- ELSE -->{L_NOTIFY_POSTER_DISAPPROVAL}<!-- ENDIF --></label>
<!-- ENDIF -->
- <!-- IF not S_APPROVE -->
+ <!-- IF not S_APPROVE and not S_RESTORE and .reason -->
<label><strong>{L_DISAPPROVE_REASON}{L_COLON}</strong>
<select name="reason_id">
<!-- BEGIN reason --><option value="{reason.ID}"<!-- IF reason.S_SELECTED --> selected="selected"<!-- ENDIF -->>{reason.DESCRIPTION}</option><!-- END reason -->
@@ -45,7 +45,7 @@
</dl>
<!-- ENDIF -->
- <!-- IF not S_APPROVE -->
+ <!-- IF not S_APPROVE and not S_RESTORE and .reason -->
<dl class="fields2 nobg">
<dt><label>{L_DISAPPROVE_REASON}{L_COLON}</label></dt>
<dd><select name="reason_id">
diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html
index db5525fcd0..45e6c10d46 100644
--- a/phpBB/styles/prosilver/template/mcp_forum.html
+++ b/phpBB/styles/prosilver/template/mcp_forum.html
@@ -45,6 +45,7 @@
<!-- IF topicrow.S_SELECT_TOPIC --><a href="{topicrow.U_SELECT_TOPIC}" class="topictitle">[ {L_SELECT_MERGE} ]</a>&nbsp;&nbsp; <!-- ENDIF -->
<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF -->
+ <!-- IF topicrow.S_TOPIC_DELETED or topicrow.S_POSTS_DELETED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.DELETED_IMG}</a> <!-- ENDIF -->
<!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF -->
<!-- IF topicrow.S_MOVED_TOPIC and S_CAN_DELETE -->&nbsp;<a href="{topicrow.U_DELETE_TOPIC}" class="topictitle">[ {L_DELETE_SHADOW_TOPIC} ]</a><!-- ENDIF -->
<br />
@@ -128,6 +129,7 @@
<select name="action">
<option value="" selected="selected">{L_SELECT_ACTION}</option>
<!-- IF S_CAN_DELETE --><option value="delete_topic">{L_DELETE}</option><!-- ENDIF -->
+ <!-- IF S_CAN_RESTORE --><option value="restore_topic">{L_RESTORE}</option><!-- ENDIF -->
<!-- IF S_CAN_MERGE --><option value="merge_topics">{L_MERGE}</option><!-- ENDIF -->
<!-- IF S_CAN_MOVE --><option value="move">{L_MOVE}</option><!-- ENDIF -->
<!-- IF S_CAN_FORK --><option value="fork">{L_FORK}</option><!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html
index 756a6eb114..4cdd62957c 100644
--- a/phpBB/styles/prosilver/template/mcp_post.html
+++ b/phpBB/styles/prosilver/template/mcp_post.html
@@ -79,6 +79,17 @@
{S_FORM_TOKEN}
</p>
</form>
+ <!-- ELSEIF S_POST_DELETED -->
+ <form method="post" id="mcp_approve" action="{U_APPROVE_ACTION}">
+
+ <p class="rules">
+ <input class="button2" type="submit" value="{L_DELETE}" name="action[disapprove]" /> &nbsp;
+ <input class="button1" type="submit" value="{L_RESTORE}" name="action[restore]" />
+ <!-- IF not S_FIRST_POST --><input type="hidden" name="mode" value="unapproved_posts" /><!-- ENDIF -->
+ <input type="hidden" name="post_id_list[]" value="{POST_ID}" />
+ {S_FORM_TOKEN}
+ </p>
+ </form>
<!-- ENDIF -->
<!-- IF S_MESSAGE_REPORTED -->
@@ -100,6 +111,13 @@
</dl>
<!-- ENDIF -->
+ <!-- IF DELETED_MESSAGE or DELETE_REASON -->
+ <div class="notice">
+ {DELETED_MESSAGE}
+ <!-- IF DELETE_REASON --><br /><strong>{L_REASON}{L_COLON}</strong> <em>{DELETE_REASON}</em><!-- ENDIF -->
+ </div>
+ <!-- ENDIF -->
+
<!-- IF SIGNATURE -->
<div id="sig{POST_ID}" class="signature">{SIGNATURE}</div>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html
index d630606175..c2d39eff98 100644
--- a/phpBB/styles/prosilver/template/mcp_queue.html
+++ b/phpBB/styles/prosilver/template/mcp_queue.html
@@ -59,7 +59,13 @@
</dd>
- <dd class="mark"><input type="checkbox" name="post_id_list[]" value="{postrow.POST_ID}" /></dd>
+ <dd class="mark">
+ <!-- IF S_TOPICS -->
+ <input type="checkbox" name="topic_id_list[]" value="{postrow.TOPIC_ID}" />
+ <!-- ELSE -->
+ <input type="checkbox" name="post_id_list[]" value="{postrow.POST_ID}" />
+ <!-- ENDIF -->
+ </dd>
</dl>
</li>
<!-- ENDIF -->
@@ -88,7 +94,13 @@
</li>
</ul>
<!-- ELSE -->
- <p class="notopics"><strong><!-- IF S_TOPICS -->{L_NO_TOPICS_QUEUE}<!-- ELSE -->{L_NO_POSTS_QUEUE}<!-- ENDIF --></strong></p>
+ <p class="notopics"><strong>
+ <!-- IF S_RESTORE -->
+ <!-- IF S_TOPICS -->{L_NO_TOPICS_DELETED}<!-- ELSE -->{L_NO_POSTS_DELETED}<!-- ENDIF -->
+ <!-- ELSE -->
+ <!-- IF S_TOPICS -->{L_NO_TOPICS_QUEUE}<!-- ELSE -->{L_NO_POSTS_QUEUE}<!-- ENDIF -->
+ <!-- ENDIF -->
+ </strong></p>
<!-- ENDIF -->
</div>
@@ -96,9 +108,20 @@
<!-- IF .postrow -->
<fieldset class="display-actions">
+ <!-- IF S_RESTORE -->
+ <input class="button2" type="submit" name="action[delete]" value="{L_DELETE}" />&nbsp;
+ <input class="button1" type="submit" name="action[restore]" value="{L_RESTORE}" />
+ <!-- ELSE -->
<input class="button2" type="submit" name="action[disapprove]" value="{L_DISAPPROVE}" />&nbsp;
<input class="button1" type="submit" name="action[approve]" value="{L_APPROVE}" />
- <div><a href="#" onclick="marklist('mcp', 'post_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'post_id_list', false); return false;">{L_UNMARK_ALL}</a></div>
+ <!-- ENDIF -->
+ <div>
+ <!-- IF S_TOPICS -->
+ <a href="#" onclick="marklist('mcp', 'topic_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'topic_id_list', false); return false;">{L_UNMARK_ALL}</a>
+ <!-- ELSE -->
+ <a href="#" onclick="marklist('mcp', 'post_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'post_id_list', false); return false;">{L_UNMARK_ALL}</a>
+ <!-- ENDIF -->
+ </div>
</fieldset>
<!-- ENDIF -->
</form>
diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html
index 8dfee55cbf..0fd5a9455f 100644
--- a/phpBB/styles/prosilver/template/mcp_topic.html
+++ b/phpBB/styles/prosilver/template/mcp_topic.html
@@ -3,33 +3,24 @@
<div class="tabs-container">
<h2><a href="{U_VIEW_TOPIC}">{L_TOPIC}{L_COLON} {TOPIC_TITLE}</a></h2>
-<script type="text/javascript">
-// <![CDATA[
-var panels = new Array('display-panel', 'split-panel', 'merge-panel');
-
<!-- IF S_MERGE_VIEW -->
- var show_panel = 'merge-panel';
+ <!-- DEFINE $SHOW_PANEL = 'merge-panel' -->
<!-- ELSEIF S_SPLIT_VIEW -->
- var show_panel = 'split-panel';
+ <!-- DEFINE $SHOW_PANEL = 'split-panel' -->
<!-- ELSE -->
- var show_panel = 'display-panel';
+ <!-- DEFINE $SHOW_PANEL = 'display-panel' -->
<!-- ENDIF -->
-onload_functions.push('subPanels()');
-
-// ]]>
-</script>
-
-<div id="minitabs">
+<div id="minitabs" class="sub-panels" data-show-panel="{$SHOW_PANEL}">
<ul>
<li id="display-panel-tab"<!-- IF not S_MERGE_VIEW --> class="activetab"<!-- ENDIF -->>
- <a href="#minitabs" onclick="subPanels('display-panel'); return false;"><span>{L_DISPLAY_OPTIONS}</span></a>
+ <a href="#minitabs" data-subpanel="display-panel"><span>{L_DISPLAY_OPTIONS}</span></a>
</li>
<li id="split-panel-tab">
- <a href="#minitabs" onclick="subPanels('split-panel'); return false;"><span>{L_SPLIT_TOPIC}</span></a>
+ <a href="#minitabs" data-subpanel="split-panel"><span>{L_SPLIT_TOPIC}</span></a>
</li>
<li id="merge-panel-tab"<!-- IF S_MERGE_VIEW --> class="activetab"<!-- ENDIF -->>
- <a href="#minitabs" onclick="subPanels('merge-panel'); return false;"><span>{L_MERGE_POSTS}</span></a>
+ <a href="#minitabs" data-subpanel="merge-panel"><span>{L_MERGE_POSTS}</span></a>
</li>
</ul>
</div>
@@ -110,9 +101,10 @@ onload_functions.push('subPanels()');
<h3><a href="{postrow.U_POST_DETAILS}">{postrow.POST_SUBJECT}</a></h3>
<p class="author"><a href="#pr{postrow.POST_ID}">{postrow.MINI_POST_IMG}</a> {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong><!-- IF postrow.U_MCP_DETAILS --> [ <a href="{postrow.U_MCP_DETAILS}">{L_POST_DETAILS}</a> ]<!-- ENDIF --></p>
- <!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_REPORTED -->
+ <!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_DELETED or postrow.S_POST_REPORTED -->
<p class="rules">
<!-- IF postrow.S_POST_UNAPPROVED -->{UNAPPROVED_IMG} <a href="{postrow.U_MCP_APPROVE}"><strong>{L_POST_UNAPPROVED}</strong></a><br /><!-- ENDIF -->
+ <!-- IF postrow.S_POST_DELETED -->{DELETED_IMG} <a href="{postrow.U_MCP_APPROVE}"><strong>{L_POST_DELETED}</strong></a><br /><!-- ENDIF -->
<!-- IF postrow.S_POST_REPORTED -->{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a><!-- ENDIF -->
</p>
<!-- ENDIF -->
@@ -159,6 +151,7 @@ onload_functions.push('subPanels()');
<!-- IF S_CAN_APPROVE --><option value="approve">{L_APPROVE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_LOCK --><option value="lock_post">{L_LOCK_POST_POSTS} [ {L_LOCK_POST_EXPLAIN} ]</option><option value="unlock_post">{L_UNLOCK_POST_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_DELETE --><option value="delete_post">{L_DELETE_POSTS}</option><!-- ENDIF -->
+ <!-- IF S_CAN_RESTORE --><option value="restore">{L_RESTORE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_MERGE --><option value="merge_posts"<!-- IF S_MERGE_VIEW --> selected="selected"<!-- ENDIF -->>{L_MERGE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_SPLIT --><option value="split_all"<!-- IF S_SPLIT_VIEW --> selected="selected"<!-- ENDIF -->>{L_SPLIT_POSTS}</option><option value="split_beyond">{L_SPLIT_AFTER}</option><!-- ENDIF -->
<!-- IF S_CAN_SYNC --><option value="resync">{L_RESYNC}</option><!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html
index eef9f53409..b948d9f627 100644
--- a/phpBB/styles/prosilver/template/overall_footer.html
+++ b/phpBB/styles/prosilver/template/overall_footer.html
@@ -5,16 +5,21 @@
<div class="navbar">
<div class="inner">
- <ul class="linklist">
+ <ul class="linklist leftside bulletin">
<li class="icon-home"><!-- IF U_SITE_HOME --><a href="{U_SITE_HOME}">{L_SITE_HOME}</a> <strong>&#8249;</strong> <!-- ENDIF --><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a>
- <!-- EVENT overall_footer_breadcrumb_append --></li>
- <!-- IF not S_IS_BOT -->
- <!-- IF U_WATCH_FORUM_LINK --><li <!-- IF S_WATCHING_FORUM -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="toggle_link" data-toggle-class="icon-<!-- IF not S_WATCHING_FORUM -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_FORUM_TOGGLE}" data-toggle-url="{U_WATCH_FORUM_TOGGLE}">{S_WATCH_FORUM_TITLE}</a></li><!-- ENDIF -->
- <!-- IF U_WATCH_TOPIC --><li <!-- IF S_WATCHING_TOPIC -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-class="<!-- IF not S_WATCHING_TOPIC -->icon-unsubscribe<!-- ELSE -->icon-subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}">{S_WATCH_TOPIC_TITLE}</a></li><!-- ENDIF -->
- <!-- IF U_BOOKMARK_TOPIC --><li class="icon-bookmark"><a href="{U_BOOKMARK_TOPIC}" title="{L_BOOKMARK_TOPIC}" data-ajax="alt_text" data-alt-text="{S_BOOKMARK_TOGGLE}">{S_BOOKMARK_TOPIC}</a></li><!-- ENDIF -->
- <!-- IF U_BUMP_TOPIC --><li class="icon-bump"><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}" data-ajax="true">{L_BUMP_TOPIC}</a></li><!-- ENDIF -->
- <!-- ENDIF -->
- <li class="rightside"><!-- IF U_TEAM --><a href="{U_TEAM}">{L_THE_TEAM}</a> &bull; <!-- ENDIF --><!-- IF not S_IS_BOT --><a href="{U_DELETE_COOKIES}" data-ajax="true" data-refresh="true">{L_DELETE_COOKIES}</a> &bull; <!-- ENDIF -->{S_TIMEZONE}</li>
+ <!-- EVENT overall_footer_breadcrumb_append -->
+ </li>
+ <!-- IF not S_IS_BOT -->
+ <!-- IF U_WATCH_FORUM_LINK --><li <!-- IF S_WATCHING_FORUM -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="toggle_link" data-toggle-class="icon-<!-- IF not S_WATCHING_FORUM -->unsubscribe<!-- ELSE -->subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_FORUM_TOGGLE}" data-toggle-url="{U_WATCH_FORUM_TOGGLE}">{S_WATCH_FORUM_TITLE}</a></li><!-- ENDIF -->
+ <!-- IF U_WATCH_TOPIC --><li <!-- IF S_WATCHING_TOPIC -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-class="<!-- IF not S_WATCHING_TOPIC -->icon-unsubscribe<!-- ELSE -->icon-subscribe<!-- ENDIF -->" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}">{S_WATCH_TOPIC_TITLE}</a></li><!-- ENDIF -->
+ <!-- IF U_BOOKMARK_TOPIC --><li class="icon-bookmark"><a href="{U_BOOKMARK_TOPIC}" title="{L_BOOKMARK_TOPIC}" data-ajax="alt_text" data-alt-text="{S_BOOKMARK_TOGGLE}">{S_BOOKMARK_TOPIC}</a></li><!-- ENDIF -->
+ <!-- IF U_BUMP_TOPIC --><li class="icon-bump"><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}" data-ajax="true">{L_BUMP_TOPIC}</a></li><!-- ENDIF -->
+ <!-- ENDIF -->
+ </ul>
+ <ul class="linklist rightside bulletin">
+ <!-- IF U_TEAM --><li><a href="{U_TEAM}">{L_THE_TEAM}</a><!-- ENDIF -->
+ <!-- IF not S_IS_BOT --><li><a href="{U_DELETE_COOKIES}" data-ajax="true" data-refresh="true">{L_DELETE_COOKIES}</a></li><!-- ENDIF -->
+ <li>{S_TIMEZONE}</li>
</ul>
</div>
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 25094bbf5d..ddbd917bd6 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -127,7 +127,7 @@
</ul>
<!-- IF not S_IS_BOT and S_USER_LOGGED_IN -->
- <ul class="linklist leftside">
+ <ul class="linklist leftside bulletin">
<!-- IF S_NOTIFICATIONS_DISPLAY -->
<li class="icon-notification">
<a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button">{NOTIFICATIONS_COUNT}</a>
@@ -170,12 +170,13 @@
<li class="icon-ucp">
<a href="{U_PROFILE}" title="{L_PROFILE}" accesskey="e">{L_PROFILE}</a>
<!-- IF S_DISPLAY_PM --> (<a href="{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF --></a>)<!-- ENDIF -->
- <!-- IF S_DISPLAY_SEARCH --> &bull;
- <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a>
- <!-- ENDIF -->
- <!-- IF U_RESTORE_PERMISSIONS --> &bull;
- <a href="{U_RESTORE_PERMISSIONS}">{L_RESTORE_PERMISSIONS}</a>
- <!-- ENDIF -->
+ </li>
+ <!-- IF S_DISPLAY_SEARCH -->
+ <li class="icon-search-self"><a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a></li>
+ <!-- ENDIF -->
+ <!-- IF U_RESTORE_PERMISSIONS -->
+ <li class="icon-restore-permissions"><a href="{U_RESTORE_PERMISSIONS}">{L_RESTORE_PERMISSIONS}</a></li>
+ <!-- ENDIF -->
</li>
</ul>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html
index 8a153a5ee8..798faa2ff7 100644
--- a/phpBB/styles/prosilver/template/posting_buttons.html
+++ b/phpBB/styles/prosilver/template/posting_buttons.html
@@ -32,9 +32,6 @@
<!-- END custom_tags -->
}
- var panels = new Array('options-panel', 'attach-panel', 'poll-panel');
- var show_panel = 'options-panel';
-
function change_palette()
{
dE('colour_palette');
diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html
index 3eac8fb03a..62e64a821e 100644
--- a/phpBB/styles/prosilver/template/posting_editor.html
+++ b/phpBB/styles/prosilver/template/posting_editor.html
@@ -67,14 +67,6 @@
<!-- ENDIF -->
<div class="clear"></div>
-
- <!-- ENDIF -->
-
- <!-- IF S_DELETE_ALLOWED -->
- <dl>
- <dt><label for="delete">{L_DELETE_POST}{L_COLON}</label></dt>
- <dd><label for="delete"><input type="checkbox" name="delete" id="delete" /> {L_DELETE_POST_WARN}</label></dd>
- </dl>
<!-- ENDIF -->
<!-- IF S_SHOW_TOPIC_ICONS or S_SHOW_PM_ICONS -->
@@ -193,11 +185,11 @@
<!-- ENDIF -->
<!-- IF not S_PRIVMSGS and not S_SHOW_DRAFTS and not $SIG_EDIT eq 1 -->
- <div id="tabs">
+ <div id="tabs" class="sub-panels" data-show-panel="options-panel">
<ul>
- <li id="options-panel-tab" class="activetab"><a href="#tabs" onclick="subPanels('options-panel'); return false;"><span>{L_OPTIONS}</span></a></li>
- <!-- IF S_SHOW_ATTACH_BOX --><li id="attach-panel-tab"><a href="#tabs" onclick="subPanels('attach-panel'); return false;"><span>{L_ADD_ATTACHMENT}</span></a></li><!-- ENDIF -->
- <!-- IF S_SHOW_POLL_BOX || S_POLL_DELETE --><li id="poll-panel-tab"><a href="#tabs" onclick="subPanels('poll-panel'); return false;"><span>{L_ADD_POLL}</span></a></li><!-- ENDIF -->
+ <li id="options-panel-tab" class="activetab"><a href="#tabs" data-subpanel="options-panel"><span>{L_OPTIONS}</span></a></li>
+ <!-- IF S_SHOW_ATTACH_BOX --><li id="attach-panel-tab"><a href="#tabs" data-subpanel="attach-panel"><span>{L_ADD_ATTACHMENT}</span></a></li><!-- ENDIF -->
+ <!-- IF S_SHOW_POLL_BOX || S_POLL_DELETE --><li id="poll-panel-tab"><a href="#tabs" data-subpanel="poll-panel"><span>{L_ADD_POLL}</span></a></li><!-- ENDIF -->
</ul>
</div>
<!-- ENDIF -->
@@ -249,6 +241,17 @@
</dl>
<!-- ENDIF -->
+ <!-- IF S_SOFTDELETE_ALLOWED or S_DELETE_ALLOWED -->
+ <hr class="dashed" />
+ <dl>
+ <dt><label for="delete">{L_DELETE_POST}{L_COLON}</label></dt>
+ <dd><label for="delete"><input type="checkbox" name="delete" id="delete" {S_SOFTDELETE_CHECKED} /> {L_DELETE_POST_WARN}</label></dd>
+ <!-- IF S_DELETE_ALLOWED and S_SOFTDELETE_ALLOWED -->
+ <dd><label for="delete_permanent"><input type="checkbox" name="delete_permanent" id="delete_permanent" /> {L_DELETE_POST_PERMANENTLY}</label></dd>
+ <!-- ENDIF -->
+ </dl>
+ <!-- ENDIF -->
+
<!-- IF S_EDIT_REASON -->
<dl>
<dt><label for="edit_reason">{L_EDIT_REASON}{L_COLON}</label></dt>
diff --git a/phpBB/styles/prosilver/template/posting_layout.html b/phpBB/styles/prosilver/template/posting_layout.html
index 4e9954ef81..c0bd0225de 100644
--- a/phpBB/styles/prosilver/template/posting_layout.html
+++ b/phpBB/styles/prosilver/template/posting_layout.html
@@ -79,12 +79,5 @@
<!-- IF S_DISPLAY_REVIEW --><!-- INCLUDE posting_topic_review.html --><!-- ENDIF -->
</form>
-<!-- IF not S_PRIVMSGS -->
-<script type="text/javascript">
-// <![CDATA[
- subPanels(show_panel);
-// ]]>
-</script>
-<!-- ENDIF -->
<!-- INCLUDE overall_footer.html -->
diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html
index e31c278a4b..f0424c45db 100644
--- a/phpBB/styles/prosilver/template/search_results.html
+++ b/phpBB/styles/prosilver/template/search_results.html
@@ -66,6 +66,7 @@
<!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->
<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> {searchresults.ATTACH_ICON_IMG}
<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --><a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF -->
+ <!-- IF searchresults.S_TOPIC_DELETED --><a href="{searchresults.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF -->
<!-- IF searchresults.S_TOPIC_REPORTED --><a href="{searchresults.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
<!-- IF .searchresults.pagination -->
<div class="pagination">
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index 9cbe7bc45a..69b0608a64 100644
--- a/phpBB/styles/prosilver/template/viewforum_body.html
+++ b/phpBB/styles/prosilver/template/viewforum_body.html
@@ -146,6 +146,7 @@
<div class="list-inner">
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF -->
+ <!-- IF topicrow.S_TOPIC_DELETED --><a href="{topicrow.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF -->
<!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
<!-- IF .topicrow.pagination -->
<div class="pagination">
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 9c0743d04d..a8bac42842 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -114,19 +114,30 @@
<!-- BEGIN postrow -->
<!-- IF postrow.S_FIRST_UNREAD --><a id="unread"></a><!-- ENDIF -->
- <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_IGNORE_POST --> online<!-- ENDIF -->">
+ <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF -->">
<div class="inner">
<div class="postbody">
- <!-- IF postrow.S_IGNORE_POST -->
- <div class="ignore">{postrow.L_IGNORE_POST}</div>
- <!-- ELSE -->
+ <!-- IF postrow.S_POST_HIDDEN -->
+ <!-- IF postrow.S_POST_DELETED -->
+ <div class="ignore" id="post_hidden{postrow.POST_ID}">
+ {postrow.L_POST_DELETED_MESSAGE}<br />
+ {postrow.L_POST_DISPLAY}
+ </div>
+ <!-- ELSEIF postrow.S_IGNORE_POST -->
+ <div class="ignore" id="post_hidden{postrow.POST_ID}">
+ {postrow.L_IGNORE_POST}<br />
+ {postrow.L_POST_DISPLAY}
+ </div>
+ <!-- ENDIF -->
+ <!-- ENDIF -->
+ <div id="post_content{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->>
<!-- IF not S_IS_BOT -->
<!-- IF postrow.U_EDIT or postrow.U_DELETE or postrow.U_REPORT or postrow.U_WARN or postrow.U_INFO or postrow.U_QUOTE -->
<ul class="profile-icons">
<!-- IF postrow.U_EDIT --><li class="edit-icon"><a href="{postrow.U_EDIT}" title="{L_EDIT_POST}"><span>{L_EDIT_POST}</span></a></li><!-- ENDIF -->
- <!-- IF postrow.U_DELETE --><li class="delete-icon"><a href="{postrow.U_DELETE}" title="{L_DELETE_POST}" data-ajax="post_delete"<!-- IF postrow.POST_NUMBER == 1 --> data-refresh="true"<!-- ENDIF -->><span>{L_DELETE_POST}</span></a></li><!-- ENDIF -->
+ <!-- IF postrow.U_DELETE --><li class="delete-icon"><a href="{postrow.U_DELETE}" title="{L_DELETE_POST}"><span>{L_DELETE_POST}</span></a></li><!-- ENDIF -->
<!-- IF postrow.U_REPORT --><li class="report-icon"><a href="{postrow.U_REPORT}" title="{L_REPORT_POST}"><span>{L_REPORT_POST}</span></a></li><!-- ENDIF -->
<!-- IF postrow.U_WARN --><li class="warn-icon"><a href="{postrow.U_WARN}" title="{L_WARN_USER}"><span>{L_WARN_USER}</span></a></li><!-- ENDIF -->
<!-- IF postrow.U_INFO --><li class="info-icon"><a href="{postrow.U_INFO}" title="{L_INFORMATION}"><span>{L_INFORMATION}</span></a></li><!-- ENDIF -->
@@ -138,8 +149,8 @@
<h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3>
<p class="author"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF -->{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> &raquo; {postrow.POST_DATE} </p>
- <!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_REPORTED -->
- <form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}" data-ajax="post_approve">
+ <!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_DELETED or postrow.S_POST_REPORTED -->
+ <form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}">
<p class="rules">
<!-- IF postrow.S_POST_UNAPPROVED -->
{UNAPPROVED_IMG} <strong>{L_POST_UNAPPROVED}</strong>
@@ -147,8 +158,18 @@
<input class="button1" type="submit" value="{L_APPROVE}" name="action[approve]" />
<input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
{S_FORM_TOKEN}
- <br /><!-- ENDIF -->
- <!-- IF postrow.S_POST_REPORTED -->{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a><!-- ENDIF -->
+ <br />
+ <!-- ELSEIF postrow.S_POST_DELETED -->
+ {DELETED_IMG} <strong>{L_POST_DELETED}</strong>
+ <input class="button2" type="submit" value="{L_DELETE}" name="action[disapprove]" />
+ <input class="button1" type="submit" value="{L_RESTORE}" name="action[restore]" />
+ <input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
+ {S_FORM_TOKEN}
+ <br />
+ <!-- ENDIF -->
+ <!-- IF postrow.S_POST_REPORTED -->
+ {REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a>
+ <!-- ENDIF -->
</p>
</form>
<!-- ENDIF -->
@@ -177,20 +198,25 @@
<!-- ENDIF -->
<!-- IF postrow.S_DISPLAY_NOTICE --><div class="rules">{L_DOWNLOAD_NOTICE}</div><!-- ENDIF -->
- <!-- IF postrow.EDITED_MESSAGE or postrow.EDIT_REASON -->
- <div class="notice">{postrow.EDITED_MESSAGE}
+ <!-- IF postrow.DELETED_MESSAGE or postrow.DELETE_REASON -->
+ <div class="notice post_deleted_msg">
+ {postrow.DELETED_MESSAGE}
+ <!-- IF postrow.DELETE_REASON --><br /><strong>{L_REASON}{L_COLON}</strong> <em>{postrow.DELETE_REASON}</em><!-- ENDIF -->
+ </div>
+ <!-- ELSEIF postrow.EDITED_MESSAGE or postrow.EDIT_REASON -->
+ <div class="notice">
+ {postrow.EDITED_MESSAGE}
<!-- IF postrow.EDIT_REASON --><br /><strong>{L_REASON}{L_COLON}</strong> <em>{postrow.EDIT_REASON}</em><!-- ENDIF -->
</div>
<!-- ENDIF -->
<!-- IF postrow.BUMPED_MESSAGE --><div class="notice"><br /><br />{postrow.BUMPED_MESSAGE}</div><!-- ENDIF -->
<!-- IF postrow.SIGNATURE --><div id="sig{postrow.POST_ID}" class="signature">{postrow.SIGNATURE}</div><!-- ENDIF -->
- <!-- ENDIF -->
+ </div>
</div>
- <!-- IF not postrow.S_IGNORE_POST -->
- <dl class="postprofile" id="profile{postrow.POST_ID}">
+ <dl class="postprofile" id="profile{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->>
<dt>
<!-- IF postrow.POSTER_AVATAR -->
<!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}">{postrow.POSTER_AVATAR}</a><!-- ELSE -->{postrow.POSTER_AVATAR}<!-- ENDIF --><br />
@@ -233,7 +259,6 @@
<!-- ENDIF -->
</dl>
- <!-- ENDIF -->
<div class="back2top"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div>
diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css
index 09021c771f..9336dd09f8 100644
--- a/phpBB/styles/prosilver/theme/buttons.css
+++ b/phpBB/styles/prosilver/theme/buttons.css
@@ -97,17 +97,9 @@ a.sendemail {
padding: 1px 0 0 17px;
}
-.icon-notification:before, .icon-notification:after {
- display: inline;
- font: inherit;
-}
-
-.icon-notification:before {
- content: '[';
-}
-
-.icon-notification:after {
- content: ']';
+ul.linklist.bulletin li.icon-home:before, ul.linklist.bulletin li.icon-ucp:before,
+ul.linklist.bulletin li.icon-bookmark:before, ul.linklist.bulletin li.icon-bump:before, ul.linklist.bulletin li.icon-subscribe:before, ul.linklist.bulletin li.icon-unsubscribe:before {
+ display: none;
}
/* Poster profile icons
diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css
index 89b3ab7ada..a2b8034187 100644
--- a/phpBB/styles/prosilver/theme/common.css
+++ b/phpBB/styles/prosilver/theme/common.css
@@ -356,6 +356,38 @@ ul.rightside {
text-align: right;
}
+/* Bulletin icons for list items
+----------------------------------------*/
+ul.linklist.bulletin li:before {
+ display: inline-block;
+ content: "\2022";
+ font-size: inherit;
+ line-height: inherit;
+ padding-right: 4px;
+}
+
+ul.linklist.bulletin li:first-child:before, ul.linklist.bulletin li.rightside:last-child:before {
+ display: none;
+}
+
+ul.linklist.bulletin li.no-bulletin:before {
+ display: none;
+}
+
+.icon-notification:before, ul.linklist.bulletin li.icon-notification:before, .icon-notification:after {
+ display: inline;
+ font: inherit;
+}
+
+.icon-notification:before, ul.linklist.bulletin li.icon-notification:before {
+ content: '[';
+ padding-right: 0;
+}
+
+.icon-notification:after {
+ content: ']';
+}
+
/* Table styles
----------------------------------------*/
table.table1 {
@@ -726,6 +758,10 @@ p.rules a {
clear: both;
}
+#notification_list ul li:before, #notification_list ul li:after {
+ display: none;
+}
+
#notification_list > .header {
padding: 0 10px;
font-family: Arial, "Helvetica Neue", Helvetica, Arial, sans-serif;
diff --git a/phpBB/styles/prosilver/theme/images/icon_topic_deleted.png b/phpBB/styles/prosilver/theme/images/icon_topic_deleted.png
new file mode 100644
index 0000000000..494b4fb563
--- /dev/null
+++ b/phpBB/styles/prosilver/theme/images/icon_topic_deleted.png
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/imageset.css b/phpBB/styles/prosilver/theme/imageset.css
index cb99e9e715..296c617f17 100644
--- a/phpBB/styles/prosilver/theme/imageset.css
+++ b/phpBB/styles/prosilver/theme/imageset.css
@@ -340,6 +340,11 @@ span.imageset {
padding-left: 16px;
padding-top: 14px;
}
+.imageset.icon_topic_deleted {
+ background-image: url("./images/icon_topic_deleted.png");
+ padding-left: 16px;
+ padding-top: 14px;
+}
.imageset.icon_topic_unapproved {
background-image: url("./images/icon_topic_unapproved.gif");
padding-left: 16px;
diff --git a/phpBB/styles/subsilver2/template/confirm_delete_body.html b/phpBB/styles/subsilver2/template/confirm_delete_body.html
new file mode 100644
index 0000000000..9e416f5195
--- /dev/null
+++ b/phpBB/styles/subsilver2/template/confirm_delete_body.html
@@ -0,0 +1,56 @@
+<!-- INCLUDE overall_header.html -->
+
+<div id="pagecontent">
+
+ <form name="confirm" action="{S_CONFIRM_ACTION}" method="post">
+
+ <table class="tablebg" width="100%" cellspacing="1">
+ <tr>
+ <th>{MESSAGE_TITLE}</th>
+ </tr>
+ <tr>
+ <td class="row1" align="center">
+ <br />
+ <p class="gen">{MESSAGE_TEXT}</p>
+ <br />
+
+ <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) -->
+ <table border="0" width="90%" cellspacing="2" cellpadding="1">
+ <!-- IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
+ <tr>
+ <td class="row1" width="22%"><b class="gen">{L_DELETE_PERMANENTLY}{L_COLON}</b></td>
+ <td class="row1" width="78%">
+ <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} />
+ <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF -->
+ </td>
+ </tr>
+ <!-- ENDIF -->
+ <!-- IF S_DELETE_REASON -->
+ <tr>
+ <td class="row1" valign="top"><span class="gen"><b>{L_DELETE_REASON}{L_COLON}</b></span><br /><span class="gensmall">{L_DELETE_REASON_EXPLAIN}</span></td>
+ <td class="row1"><input type="text" name="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></td>
+ </tr>
+ <!-- ENDIF -->
+ </table>
+ <br />
+ <!-- ENDIF -->
+ {S_HIDDEN_FIELDS}
+ <input type="submit" name="confirm" value="{L_YES}" class="btnmain" />&nbsp;&nbsp;
+ <input type="submit" name="cancel" value="{L_NO}" class="btnlite" />
+ </td>
+ </tr>
+ </table>
+
+ </form>
+
+</div>
+
+<br clear="all" />
+
+<!-- INCLUDE breadcrumbs.html -->
+
+<br clear="all" />
+
+<div align="{S_CONTENT_FLOW_END}"><!-- INCLUDE jumpbox.html --></div>
+
+<!-- INCLUDE overall_footer.html -->
diff --git a/phpBB/styles/subsilver2/template/forumlist_body.html b/phpBB/styles/subsilver2/template/forumlist_body.html
index 3e30561f3a..a222607ae8 100644
--- a/phpBB/styles/subsilver2/template/forumlist_body.html
+++ b/phpBB/styles/subsilver2/template/forumlist_body.html
@@ -64,7 +64,14 @@
<!-- EVENT forumlist_body_last_post_title_prepend -->
<p class="topicdetails"><a href="{forumrow.U_LAST_POST}" title="{forumrow.LAST_POST_SUBJECT}" class="lastsubject">{forumrow.LAST_POST_SUBJECT_TRUNCATED}</a></p>
<!-- ENDIF -->
- <p class="topicdetails"><!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}" class="imageset">{UNAPPROVED_IMG}</a>&nbsp;<!-- ENDIF -->{forumrow.LAST_POST_TIME}</p>
+ <p class="topicdetails">
+ <!-- IF forumrow.U_UNAPPROVED_TOPICS -->
+ <a href="{forumrow.U_UNAPPROVED_TOPICS}" class="imageset">{UNAPPROVED_IMG}</a>&nbsp;
+ <!-- ELSEIF forumrow.U_UNAPPROVED_POSTS -->
+ <a href="{forumrow.U_UNAPPROVED_POSTS}" class="imageset">{UNAPPROVED_POST_IMG}</a>&nbsp;
+ <!-- ENDIF -->
+ {forumrow.LAST_POST_TIME}
+ </p>
<p class="topicdetails">{forumrow.LAST_POSTER_FULL}
<!-- IF not S_IS_BOT --><a href="{forumrow.U_LAST_POST}" class="imageset">{LAST_POST_IMG}</a><!-- ENDIF -->
</p>
diff --git a/phpBB/styles/subsilver2/template/mcp_approve.html b/phpBB/styles/subsilver2/template/mcp_approve.html
index 5ad7d2f9b5..8c2ef0806b 100644
--- a/phpBB/styles/subsilver2/template/mcp_approve.html
+++ b/phpBB/styles/subsilver2/template/mcp_approve.html
@@ -16,7 +16,7 @@
<!-- IF S_NOTIFY_POSTER -->
<input type="checkbox" class="radio" name="notify_poster" checked="checked" /><span class="gen"><!-- IF S_APPROVE -->{L_NOTIFY_POSTER_APPROVAL}<!-- ELSE -->{L_NOTIFY_POSTER_DISAPPROVAL}<!-- ENDIF --></span><br />
<!-- ENDIF -->
- <!-- IF not S_APPROVE -->
+ <!-- IF not S_APPROVE and not S_RESTORE and .reason -->
<br />
<table border="0" width="90%" cellspacing="2" cellpadding="1">
<tr>
diff --git a/phpBB/styles/subsilver2/template/mcp_forum.html b/phpBB/styles/subsilver2/template/mcp_forum.html
index 6972f14b79..b168bf3ac8 100644
--- a/phpBB/styles/subsilver2/template/mcp_forum.html
+++ b/phpBB/styles/subsilver2/template/mcp_forum.html
@@ -33,6 +33,9 @@
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED -->
<a href="{topicrow.U_MCP_QUEUE}" class="imageset">{topicrow.UNAPPROVED_IMG}</a>&nbsp;
<!-- ENDIF -->
+ <!-- IF topicrow.S_TOPIC_DELETED or topicrow.S_POSTS_DELETED -->
+ <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{topicrow.DELETED_IMG}</a>&nbsp;
+ <!-- ENDIF -->
<!-- IF topicrow.S_TOPIC_REPORTED and topicrow.U_MCP_REPORT -->
<a href="{topicrow.U_MCP_REPORT}" class="imageset">{REPORTED_IMG}</a>&nbsp;
<!-- ENDIF -->
@@ -58,6 +61,7 @@
<select name="action">
<option value="" selected="selected">{L_SELECT_ACTION}</option>
<!-- IF S_CAN_DELETE --><option value="delete_topic">{L_DELETE}</option><!-- ENDIF -->
+ <!-- IF S_CAN_RESTORE --><option value="restore_topic">{L_RESTORE}</option><!-- ENDIF -->
<!-- IF S_CAN_MERGE --><option value="merge_topics">{L_MERGE}</option><!-- ENDIF -->
<!-- IF S_CAN_MOVE --><option value="move">{L_MOVE}</option><!-- ENDIF -->
<!-- IF S_CAN_FORK --><option value="fork">{L_FORK}</option><!-- ENDIF -->
diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html
index 910accd09f..a3ebb00d06 100644
--- a/phpBB/styles/subsilver2/template/mcp_post.html
+++ b/phpBB/styles/subsilver2/template/mcp_post.html
@@ -50,7 +50,12 @@
</tr>
<tr>
<td class="row1"><b class="gen"><!-- IF S_PM -->{L_PM_SUBJECT}<!-- ELSE -->{L_POST_SUBJECT}<!-- ENDIF -->{L_COLON} </b></td>
- <td class="row2"><span class="gen">{POST_SUBJECT}</span> <!-- IF S_POST_UNAPPROVED --><span class="postapprove">{UNAPPROVED_IMG} <a href="{U_MCP_APPROVE}">{L_POST_UNAPPROVED}</a></span> <!-- ENDIF --> <!-- IF S_POST_REPORTED and not S_MCP_REPORT --><span class="postreported">{REPORTED_IMG} <a href="{U_MCP_REPORT}">{L_POST_REPORTED}</a></span><!-- ENDIF --></td>
+ <td class="row2">
+ <span class="gen">{POST_SUBJECT}</span>
+ <!-- IF S_POST_UNAPPROVED --><span class="postapprove">{UNAPPROVED_IMG} <a href="{U_MCP_APPROVE}">{L_POST_UNAPPROVED}</a></span> <!-- ENDIF -->
+ <!-- IF S_POST_DELETED --><span class="postapprove">{DELETED_IMG} <a href="{U_MCP_APPROVE}">{L_POST_DELETED}</a></span> <!-- ENDIF -->
+ <!-- IF S_POST_REPORTED and not S_MCP_REPORT --><span class="postreported">{REPORTED_IMG} <a href="{U_MCP_REPORT}">{L_POST_REPORTED}</a></span><!-- ENDIF -->
+ </td>
</tr>
<tr>
<td class="row1" width="20%"><b class="gen"><!-- IF S_PM -->{L_PM_FROM}<!-- ELSE -->{L_POSTER}<!-- ENDIF -->{L_COLON} </b></td>
diff --git a/phpBB/styles/subsilver2/template/mcp_queue.html b/phpBB/styles/subsilver2/template/mcp_queue.html
index febde7e59c..7ca659b5da 100644
--- a/phpBB/styles/subsilver2/template/mcp_queue.html
+++ b/phpBB/styles/subsilver2/template/mcp_queue.html
@@ -23,15 +23,37 @@
<td style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top" nowrap="nowrap"><span class="gen">{postrow.POST_AUTHOR_FULL}</span><br />
<span class="gensmall">[ <a href="{postrow.U_VIEW_DETAILS}">{L_VIEW_DETAILS}</a> ]</span></td>
<td class="postdetails" style="padding: 4px;" align="{S_CONTENT_FLOW_BEGIN}" valign="top" nowrap="nowrap">{postrow.POST_TIME}</td>
- <td align="center"><input type="checkbox" class="radio" name="post_id_list[]" value="{postrow.POST_ID}" /></td>
+ <td align="center">
+ <!-- IF S_TOPICS -->
+ <input type="checkbox" class="radio" name="topic_id_list[]" value="{postrow.TOPIC_ID}" />
+ <!-- ELSE -->
+ <input type="checkbox" class="radio" name="post_id_list[]" value="{postrow.POST_ID}" />
+ <!-- ENDIF -->
+ </td>
</tr>
<!-- BEGINELSE -->
<tr>
- <td class="row1" colspan="4" height="30" align="center" valign="middle"><span class="gen"><!-- IF S_TOPICS -->{L_NO_TOPICS_QUEUE}<!-- ELSE -->{L_NO_POSTS_QUEUE}<!-- ENDIF --></span></td>
+ <td class="row1" colspan="4" height="30" align="center" valign="middle">
+ <span class="gen">
+ <!-- IF S_RESTORE -->
+ <!-- IF S_TOPICS -->{L_NO_TOPICS_DELETED}<!-- ELSE -->{L_NO_POSTS_DELETED}<!-- ENDIF -->
+ <!-- ELSE -->
+ <!-- IF S_TOPICS -->{L_NO_TOPICS_QUEUE}<!-- ELSE -->{L_NO_POSTS_QUEUE}<!-- ENDIF -->
+ <!-- ENDIF -->
+ </span>
+ </td>
</tr>
<!-- END postrow -->
<tr>
- <td class="cat" colspan="4" align="center"><input class="btnmain" type="submit" name="action[approve]" value="{L_APPROVE}" />&nbsp;&nbsp;<input class="btnlite" type="submit" name="action[disapprove]" value="{L_DISAPPROVE}" /></td>
+ <td class="cat" colspan="4" align="center">
+ <!-- IF S_RESTORE -->
+ <input class="btnlite" type="submit" name="action[delete]" value="{L_DELETE}" />&nbsp;&nbsp;
+ <input class="btnmain" type="submit" name="action[restore]" value="{L_RESTORE}" />
+ <!-- ELSE -->
+ <input class="btnmain" type="submit" name="action[approve]" value="{L_APPROVE}" />&nbsp;&nbsp;
+ <input class="btnlite" type="submit" name="action[disapprove]" value="{L_DISAPPROVE}" />
+ <!-- ENDIF -->
+ </td>
</tr>
</table>
{S_FORM_TOKEN}
@@ -39,7 +61,15 @@
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
- <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="gensmall"><a href="#" onclick="marklist('mcp', '', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', '', false); return false;">{L_UNMARK_ALL}</a></b></td>
+ <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">
+ <b class="gensmall">
+ <!-- IF S_TOPICS -->
+ <a href="#" onclick="marklist('mcp', 'topic_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'topic_id_list', false); return false;">{L_UNMARK_ALL}</a>
+ <!-- ELSE -->
+ <a href="#" onclick="marklist('mcp', 'post_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'post_id_list', false); return false;">{L_UNMARK_ALL}</a>
+ <!-- ENDIF -->
+ </b>
+ </td>
</tr>
</table>
diff --git a/phpBB/styles/subsilver2/template/mcp_topic.html b/phpBB/styles/subsilver2/template/mcp_topic.html
index 014d8b9468..d3b4408243 100644
--- a/phpBB/styles/subsilver2/template/mcp_topic.html
+++ b/phpBB/styles/subsilver2/template/mcp_topic.html
@@ -112,6 +112,7 @@
<tr valign="middle">
<td width="100%">
<!-- IF postrow.S_POST_UNAPPROVED and postrow.U_MCP_APPROVE --><span class="postapprove">{UNAPPROVED_IMG} <a href="{postrow.U_MCP_APPROVE}">{L_POST_UNAPPROVED}</a></span><br /><!-- ENDIF -->
+ <!-- IF postrow.S_POST_DELETED and postrow.U_MCP_APPROVE --><span class="postapprove">{DELETED_IMG} <a href="{postrow.U_MCP_APPROVE}">{L_POST_DELETED}</a></span><br /><!-- ENDIF -->
<!-- IF postrow.S_POST_REPORTED and postrow.U_MCP_REPORT --><span class="postreported">{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}">{L_POST_REPORTED}</a></span><!-- ENDIF -->
</td>
<td width="10" nowrap="nowrap">{postrow.MINI_POST_IMG}</td>
@@ -133,6 +134,7 @@
<!-- IF S_CAN_APPROVE --><option value="approve">{L_APPROVE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_LOCK --><option value="lock_post">{L_LOCK_POST_POSTS} [ {L_LOCK_POST_EXPLAIN} ]</option><option value="unlock_post">{L_UNLOCK_POST_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_DELETE --><option value="delete_post">{L_DELETE_POSTS}</option><!-- ENDIF -->
+ <!-- IF S_CAN_RESTORE --><option value="restore">{L_RESTORE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_MERGE --><option value="merge_posts"<!-- IF ACTION eq 'merge' --> selected="selected"<!-- ENDIF -->>{L_MERGE_POSTS}</option><!-- ENDIF -->
<!-- IF S_CAN_SPLIT --><option value="split_all"<!-- IF ACTION eq 'split' --> selected="selected"<!-- ENDIF -->>{L_SPLIT_POSTS}</option><option value="split_beyond">{L_SPLIT_AFTER}</option><!-- ENDIF -->
<!-- IF S_CAN_SYNC --><option value="resync">{L_RESYNC}</option><!-- ENDIF -->
diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html
index 4feb4e955a..635b05aaa0 100644
--- a/phpBB/styles/subsilver2/template/posting_body.html
+++ b/phpBB/styles/subsilver2/template/posting_body.html
@@ -114,13 +114,6 @@
</tr>
<!-- ENDIF -->
-<!-- IF S_DELETE_ALLOWED -->
- <tr>
- <td class="row1"><b class="genmed">{L_DELETE_POST}{L_COLON}</b></td>
- <td class="row2"><input type="checkbox" class="radio" name="delete" /> <span class="gensmall">[ {L_DELETE_POST_WARN} ]</span></td>
- </tr>
-<!-- ENDIF -->
-
<!-- IF S_SHOW_TOPIC_ICONS or S_SHOW_PM_ICONS -->
<tr>
<td class="row1"><b class="genmed">{L_ICON}{L_COLON}</b></td>
@@ -310,7 +303,7 @@
<!-- IF S_TYPE_TOGGLE -->
<tr>
- <td>&nbsp;</td>
+ <td></td>
<td class="gen"><!-- IF S_EDIT_POST -->{L_CHANGE_TOPIC_TO}<!-- ELSE -->{L_POST_TOPIC_AS}<!-- ENDIF -->{L_COLON} <!-- BEGIN topic_type --><input type="radio" class="radio" name="topic_type" value="{topic_type.VALUE}"{topic_type.S_CHECKED} />{topic_type.L_TOPIC_TYPE}&nbsp;&nbsp;<!-- END topic_type --></td>
</tr>
<!-- ENDIF -->
@@ -319,6 +312,26 @@
</td>
</tr>
+<!-- IF S_SOFTDELETE_ALLOWED or S_DELETE_ALLOWED -->
+ <tr>
+ <td class="row1" valign="top"><b class="genmed">{L_DELETE_POST}{L_COLON}</b></td>
+ <td class="row2">
+ <table cellpadding="1">
+ <tr>
+ <td><input type="checkbox" class="radio" name="delete" /></td>
+ <td class="gen">{L_DELETE_POST_WARN}</td>
+ </tr>
+ <!-- IF S_SOFTDELETE_ALLOWED and S_DELETE_ALLOWED -->
+ <tr>
+ <td><input type="checkbox" class="radio" name="delete_permanent" /></td>
+ <td class="gen">{L_DELETE_POST_PERMANENTLY}</td>
+ </tr>
+ <!-- ENDIF -->
+ </table>
+ </td>
+ </tr>
+<!-- ENDIF -->
+
<!-- IF S_TOPIC_TYPE_ANNOUNCE or S_TOPIC_TYPE_STICKY -->
<tr>
<td class="row1"><b class="genmed">{L_STICK_TOPIC_FOR}{L_COLON}</b><br /><span class="gensmall">{L_STICKY_ANNOUNCE_TIME_LIMIT}</span></td>
diff --git a/phpBB/styles/subsilver2/template/search_results.html b/phpBB/styles/subsilver2/template/search_results.html
index 8ced5a5301..d98079de20 100644
--- a/phpBB/styles/subsilver2/template/search_results.html
+++ b/phpBB/styles/subsilver2/template/search_results.html
@@ -39,6 +39,9 @@
<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED -->
<a href="{searchresults.U_MCP_QUEUE}" class="imageset">{searchresults.UNAPPROVED_IMG}</a>&nbsp;
<!-- ENDIF -->
+ <!-- IF searchresults.S_TOPIC_DELETED -->
+ <a href="{searchresults.U_MCP_QUEUE}" class="imageset">{DELETED_IMG}</a>&nbsp;
+ <!-- ENDIF -->
<!-- IF searchresults.S_TOPIC_REPORTED -->
<a href="{searchresults.U_MCP_REPORT}" class="imageset">{REPORTED_IMG}</a>&nbsp;
<!-- ENDIF -->
diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html
index 664a6a26c5..d07e9a1372 100644
--- a/phpBB/styles/subsilver2/template/viewforum_body.html
+++ b/phpBB/styles/subsilver2/template/viewforum_body.html
@@ -43,7 +43,10 @@
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF -->
{topicrow.ATTACH_ICON_IMG} <!-- IF topicrow.S_HAS_POLL or topicrow.S_TOPIC_MOVED --><b>{topicrow.TOPIC_TYPE}</b> <!-- ENDIF --><a title="{L_POSTED}{L_COLON} {topicrow.FIRST_POST_TIME}" href="{topicrow.U_VIEW_TOPIC}"class="topictitle">{topicrow.TOPIC_TITLE}</a>
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED -->
- <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{UNAPPROVED_IMG}</a>&nbsp;
+ <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{topicrow.UNAPPROVED_IMG}</a>&nbsp;
+ <!-- ENDIF -->
+ <!-- IF topicrow.S_TOPIC_DELETED -->
+ <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{DELETED_IMG}</a>&nbsp;
<!-- ENDIF -->
<!-- IF topicrow.S_TOPIC_REPORTED -->
<a href="{topicrow.U_MCP_REPORT}" class="imageset">{REPORTED_IMG}</a>&nbsp;
@@ -205,6 +208,9 @@
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED -->
<a href="{topicrow.U_MCP_QUEUE}" class="imageset">{topicrow.UNAPPROVED_IMG}</a>&nbsp;
<!-- ENDIF -->
+ <!-- IF topicrow.S_TOPIC_DELETED -->
+ <a href="{topicrow.U_MCP_QUEUE}" class="imageset">{DELETED_IMG}</a>&nbsp;
+ <!-- ENDIF -->
<!-- IF topicrow.S_TOPIC_REPORTED -->
<a href="{topicrow.U_MCP_REPORT}" class="imageset">{REPORTED_IMG}</a>&nbsp;
<!-- ENDIF -->
diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html
index b561b99abd..299b8219eb 100644
--- a/phpBB/styles/subsilver2/template/viewtopic_body.html
+++ b/phpBB/styles/subsilver2/template/viewtopic_body.html
@@ -136,8 +136,19 @@
<!-- ENDIF -->
<!-- IF postrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
- <!-- IF postrow.S_IGNORE_POST -->
- <td class="gensmall" colspan="2" height="25" align="center"><!-- IF postrow.S_FIRST_UNREAD --><a name="unread"></a><!-- ENDIF --><a name="p{postrow.POST_ID}"></a>{postrow.L_IGNORE_POST}</td>
+ <!-- IF postrow.S_POST_HIDDEN -->
+ <td class="gensmall" colspan="2" height="25" align="center">
+ <!-- IF postrow.S_FIRST_UNREAD --><a name="unread"></a><!-- ENDIF -->
+ <a name="p{postrow.POST_ID}"></a>
+ <!-- IF postrow.S_POST_HIDDEN -->
+ <!-- IF postrow.S_POST_DELETED -->
+ {postrow.L_POST_DELETED_MESSAGE}
+ <!-- ELSEIF postrow.S_IGNORE_POST -->
+ {postrow.L_IGNORE_POST}
+ <!-- ENDIF -->
+ <br />{postrow.L_POST_DISPLAY}
+ <!-- ENDIF -->
+ </td>
<!-- ELSE -->
<td align="center" valign="middle">
@@ -207,10 +218,14 @@
<table width="100%" cellspacing="5">
<tr>
<td>
- <!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_REPORTED -->
+ <!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_DELETED or postrow.S_POST_REPORTED -->
<table width="100%" cellspacing="0">
<tr>
- <td class="gensmall"><!-- IF postrow.S_POST_UNAPPROVED --><span class="postapprove">{UNAPPROVED_IMG} <a href="{postrow.U_MCP_APPROVE}">{L_POST_UNAPPROVED}</a></span><br /> <!-- ENDIF --> <!-- IF postrow.S_POST_REPORTED --><span class="postreported">{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}">{L_POST_REPORTED}</a></span><!-- ENDIF --></td>
+ <td class="gensmall">
+ <!-- IF postrow.S_POST_UNAPPROVED --><span class="postapprove">{UNAPPROVED_IMG} <a href="{postrow.U_MCP_APPROVE}">{L_POST_UNAPPROVED}</a></span><br /> <!-- ENDIF -->
+ <!-- IF postrow.S_POST_DELETED --><span class="postapprove">{DELETED_IMG} <a href="{postrow.U_MCP_RESTORE}">{L_POST_DELETED}</a></span><br /> <!-- ENDIF -->
+ <!-- IF postrow.S_POST_REPORTED --><span class="postreported">{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}">{L_POST_REPORTED}</a></span><!-- ENDIF -->
+ </td>
</tr>
</table>
@@ -241,7 +256,22 @@
<div class="postbody"><br />_________________<br />{postrow.SIGNATURE}</div>
<!-- ENDIF -->
- <!-- IF postrow.EDITED_MESSAGE or postrow.EDIT_REASON -->
+ <!-- IF postrow.DELETED_MESSAGE or postrow.DELETE_REASON -->
+ <!-- IF postrow.DELETE_REASON -->
+ <br /><br />
+ <table class="tablebg" width="100%" cellspacing="1">
+ <tr>
+ <td class="row3"><span class="gensmall">{postrow.DELETED_MESSAGE}</span></td>
+ </tr>
+ <tr>
+ <td class="row2"><span class="genmed">{postrow.DELETE_REASON}</span></td>
+ </tr>
+ </table>
+ <!-- ELSE -->
+ <br /><br />
+ <span class="gensmall">{postrow.DELETED_MESSAGE}</span>
+ <!-- ENDIF -->
+ <!-- ELSEIF postrow.EDITED_MESSAGE or postrow.EDIT_REASON -->
<!-- IF postrow.EDIT_REASON -->
<br /><br />
<table class="tablebg" width="100%" cellspacing="1">
diff --git a/phpBB/styles/subsilver2/theme/images/icon_topic_deleted.png b/phpBB/styles/subsilver2/theme/images/icon_topic_deleted.png
new file mode 100644
index 0000000000..494b4fb563
--- /dev/null
+++ b/phpBB/styles/subsilver2/theme/images/icon_topic_deleted.png
Binary files differ
diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css
index df46c91d8d..bfb80a53b5 100644
--- a/phpBB/styles/subsilver2/theme/stylesheet.css
+++ b/phpBB/styles/subsilver2/theme/stylesheet.css
@@ -985,6 +985,11 @@ a.imageset {
padding-left: 19px;
padding-top: 18px;
}
+.imageset.icon_topic_deleted {
+ background-image: url("./images/icon_topic_deleted.png");
+ padding-left: 14px;
+ padding-top: 14px;
+}
/* English images for fallback */
diff --git a/phpBB/ucp.php b/phpBB/ucp.php
index a7e75f76c4..7180c54de6 100644
--- a/phpBB/ucp.php
+++ b/phpBB/ucp.php
@@ -85,17 +85,16 @@ switch ($mode)
{
$user->session_kill();
$user->session_begin();
- $message = $user->lang['LOGOUT_REDIRECT'];
}
- else
+ else if ($user->data['user_id'] != ANONYMOUS)
{
- $message = ($user->data['user_id'] == ANONYMOUS) ? $user->lang['LOGOUT_REDIRECT'] : $user->lang['LOGOUT_FAILED'];
- }
- meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
+ meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
- $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> ');
- trigger_error($message);
+ $message = $user->lang['LOGOUT_FAILED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> ');
+ trigger_error($message);
+ }
+ redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
break;
case 'terms':
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 5fed514a12..5a59e021b3 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -105,7 +105,7 @@ if ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'])
if ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK)
{
$sql = 'UPDATE ' . FORUMS_TABLE . '
- SET forum_posts = forum_posts + 1
+ SET forum_posts_approved = forum_posts_approved + 1
WHERE forum_id = ' . $forum_id;
$db->sql_query($sql);
}
@@ -241,14 +241,14 @@ gen_forum_auth_level('forum', $forum_id, $forum_data['forum_status']);
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
-$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
+$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
+$phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
// Limit topics to certain time frame, obtain correct topic count
-// global announcements must not be counted, normal announcements have to
-// be counted, as forum_topics(_real) includes them
if ($sort_days)
{
$min_post_time = time() - ($sort_days * 86400);
@@ -259,7 +259,7 @@ if ($sort_days)
AND (topic_last_post_time >= $min_post_time
OR topic_type = " . POST_ANNOUNCE . '
OR topic_type = ' . POST_GLOBAL . ')
- ' . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND topic_approved = 1');
+ AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id);
$result = $db->sql_query($sql);
$topics_count = (int) $db->sql_fetchfield('num_topics');
$db->sql_freeresult($result);
@@ -275,7 +275,7 @@ if ($sort_days)
}
else
{
- $topics_count = ($auth->acl_get('m_approve', $forum_id)) ? $forum_data['forum_topics_real'] : $forum_data['forum_topics'];
+ $topics_count = $phpbb_content_visibility->get_count('forum_topics', $forum_data, $forum_id);
$sql_limit_time = '';
}
@@ -325,6 +325,7 @@ $template->assign_vars(array(
'FOLDER_MOVED_IMG' => $user->img('topic_moved', 'TOPIC_MOVED'),
'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'),
+ 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'),
'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'),
'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'],
@@ -371,7 +372,7 @@ $sql_array = array(
'LEFT_JOIN' => array(),
);
-$sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1';
+$sql_approved = ' AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
if ($user->data['is_registered'])
{
@@ -422,9 +423,9 @@ if ($forum_data['forum_type'] == FORUM_POST)
while ($row = $db->sql_fetchrow($result))
{
- if (!$row['topic_approved'] && !$auth->acl_get('m_approve', $row['forum_id']))
+ if ($row['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $row['forum_id']))
{
- // Do not display announcements that are waiting for approval.
+ // Do not display announcements that are waiting for approval or soft deleted.
continue;
}
@@ -683,7 +684,7 @@ if (sizeof($topic_list))
$s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
// Replies
- $replies = ($auth->acl_get('m_approve', $topic_forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
+ $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $topic_forum_id) - 1;
if ($row['topic_status'] == ITEM_MOVED)
{
@@ -703,9 +704,12 @@ if (sizeof($topic_list))
$view_topic_url_params = 'f=' . $row['forum_id'] . '&amp;t=' . $topic_id;
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
- $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
- $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
+ $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $row['forum_id']));
+ $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id']));
+ $topic_deleted = $row['topic_visibility'] == ITEM_DELETED;
+
$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&amp;t=$topic_id", true, $user->session_id) : '';
+ $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=deleted_topics&amp;t=' . $topic_id, true, $user->session_id) : $u_mcp_queue;
// Send vars to template
$topic_row = array(
@@ -744,6 +748,7 @@ if (sizeof($topic_list))
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
'S_POSTS_UNAPPROVED' => $posts_unapproved,
+ 'S_TOPIC_DELETED' => $topic_deleted,
'S_HAS_POLL' => ($row['poll_start']) ? true : false,
'S_POST_ANNOUNCE' => ($row['topic_type'] == POST_ANNOUNCE) ? true : false,
'S_POST_GLOBAL' => ($row['topic_type'] == POST_GLOBAL) ? true : false,
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 4dd03202f1..1e444f47ad 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -55,6 +55,8 @@ if (!$topic_id && !$post_id)
trigger_error('NO_TOPIC');
}
+$phpbb_content_visibility = $phpbb_container->get('content.visibility');
+
// Find topic id if user requested a newer or older topic
if ($view && !$post_id)
{
@@ -77,13 +79,12 @@ if ($view && !$post_id)
{
// Get topic tracking info
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);
-
$topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0;
$sql = 'SELECT post_id, topic_id, forum_id
FROM ' . POSTS_TABLE . "
WHERE topic_id = $topic_id
- " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1') . "
+ AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . "
AND post_time > $topic_last_read
AND forum_id = $forum_id
ORDER BY post_time ASC";
@@ -137,7 +138,7 @@ if ($view && !$post_id)
WHERE forum_id = ' . $row['forum_id'] . "
AND topic_moved_id = 0
AND topic_last_post_time $sql_condition {$row['topic_last_post_time']}
- " . (($auth->acl_get('m_approve', $row['forum_id'])) ? '' : 'AND topic_approved = 1') . "
+ AND " . $phpbb_content_visibility->get_visibility_sql('topic', $row['forum_id']) . "
ORDER BY topic_last_post_time $sql_ordering";
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
@@ -181,7 +182,7 @@ $sql_array = array(
// The FROM-Order is quite important here, else t.* columns can not be correctly bound.
if ($post_id)
{
- $sql_array['SELECT'] .= ', p.post_approved, p.post_time, p.post_id';
+ $sql_array['SELECT'] .= ', p.post_visibility, p.post_time, p.post_id';
$sql_array['FROM'][POSTS_TABLE] = 'p';
}
@@ -252,11 +253,18 @@ if (!$topic_data)
}
$forum_id = (int) $topic_data['forum_id'];
+
+// Now we know the forum_id and can check the permissions
+if ($topic_data['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id))
+{
+ trigger_error('NO_TOPIC');
+}
+
// This is for determining where we are (page)
if ($post_id)
{
// are we where we are supposed to be?
- if (!$topic_data['post_approved'] && !$auth->acl_get('m_approve', $topic_data['forum_id']))
+ if ($topic_data['post_visibility'] == ITEM_UNAPPROVED && !$auth->acl_get('m_approve', $topic_data['forum_id']))
{
// If post_id was submitted, we try at least to display the topic as a last resort...
if ($topic_id)
@@ -272,7 +280,7 @@ if ($post_id)
if ($sort_dir == $check_sort)
{
- $topic_data['prev_posts'] = ($auth->acl_get('m_approve', $forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies'];
+ $topic_data['prev_posts'] = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1;
}
else
{
@@ -284,7 +292,7 @@ if ($post_id)
$sql = 'SELECT COUNT(p.post_id) AS prev_posts
FROM ' . POSTS_TABLE . " p
WHERE p.topic_id = {$topic_data['topic_id']}
- " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '');
+ AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.');
if ($sort_dir == 'd')
{
@@ -304,8 +312,7 @@ if ($post_id)
}
$topic_id = (int) $topic_data['topic_id'];
-//
-$topic_replies = ($auth->acl_get('m_approve', $forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies'];
+$topic_replies = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1;
// Check sticky/announcement time limit
if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == POST_ANNOUNCE) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time())
@@ -322,11 +329,6 @@ if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == PO
// Setup look and feel
$user->setup('viewtopic', $topic_data['forum_style']);
-if (!$topic_data['topic_approved'] && !$auth->acl_get('m_approve', $forum_id))
-{
- trigger_error('NO_TOPIC');
-}
-
// Start auth check
if (!$auth->acl_get('f_read', $forum_id))
{
@@ -409,7 +411,7 @@ if ($sort_days)
FROM ' . POSTS_TABLE . "
WHERE topic_id = $topic_id
AND post_time >= $min_post_time
- " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1');
+ AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id);
$result = $db->sql_query($sql);
$total_posts = (int) $db->sql_fetchfield('num_posts');
$db->sql_freeresult($result);
@@ -531,7 +533,8 @@ $quickmod_array = array(
'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))),
'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))),
- 'delete_topic' => array('DELETE_TOPIC', $auth->acl_get('m_delete', $forum_id)),
+ 'delete_topic' => array('DELETE_TOPIC', ($auth->acl_get('m_delete', $forum_id) || (($topic_data['topic_visibility'] != ITEM_DELETED) && $auth->acl_get('m_softdelete', $forum_id)))),
+ 'restore_topic' => array('RESTORE_TOPIC', (($topic_data['topic_visibility'] == ITEM_DELETED) && $auth->acl_get('m_approve', $forum_id))),
'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED),
'split' => array('SPLIT_TOPIC', $auth->acl_get('m_split', $forum_id)),
'merge' => array('MERGE_POSTS', $auth->acl_get('m_merge', $forum_id)),
@@ -616,6 +619,7 @@ $template->assign_vars(array(
'REPLY_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'TOPIC_LOCKED') : $user->img('button_topic_reply', 'REPLY_TO_TOPIC'),
'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'),
'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'),
+ 'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED_RESTORE'),
'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'),
'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'),
'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'),
@@ -936,7 +940,7 @@ else
}
// Container for user details, only process once
-$post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = array();
+$post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = $post_delete_list = array();
$has_attachments = $display_notice = false;
$bbcode_bitfield = '';
$i = $i_total = 0;
@@ -945,7 +949,7 @@ $i = $i_total = 0;
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p' . (($join_user_sql[$sort_key]) ? ', ' . USERS_TABLE . ' u': '') . "
WHERE p.topic_id = $topic_id
- " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . "
+ AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . "
" . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . "
$limit_posts_time
ORDER BY $sql_sort_order";
@@ -1027,14 +1031,14 @@ while ($row = $db->sql_fetchrow($result))
{
$attach_list[] = (int) $row['post_id'];
- if ($row['post_approved'])
+ if ($row['post_visibility'] == ITEM_UNAPPROVED)
{
$has_attachments = true;
}
}
$rowset[$row['post_id']] = array(
- 'hide_post' => ($row['foe'] && ($view != 'show' || $post_id != $row['post_id'])) ? true : false,
+ 'hide_post' => (($row['foe'] || $row['post_visibility'] == ITEM_DELETED) && ($view != 'show' || $post_id != $row['post_id'])) ? true : false,
'post_id' => $row['post_id'],
'post_time' => $row['post_time'],
@@ -1049,11 +1053,14 @@ while ($row = $db->sql_fetchrow($result))
'post_edit_reason' => $row['post_edit_reason'],
'post_edit_user' => $row['post_edit_user'],
'post_edit_locked' => $row['post_edit_locked'],
+ 'post_delete_time' => $row['post_delete_time'],
+ 'post_delete_reason'=> $row['post_delete_reason'],
+ 'post_delete_user' => $row['post_delete_user'],
// Make sure the icon actually exists
'icon_id' => (isset($icons[$row['icon_id']]['img'], $icons[$row['icon_id']]['height'], $icons[$row['icon_id']]['width'])) ? $row['icon_id'] : 0,
'post_attachment' => $row['post_attachment'],
- 'post_approved' => $row['post_approved'],
+ 'post_visibility' => $row['post_visibility'],
'post_reported' => $row['post_reported'],
'post_username' => $row['post_username'],
'post_text' => $row['post_text'],
@@ -1320,8 +1327,8 @@ if (sizeof($attach_list))
$sql = 'SELECT a.post_msg_id as post_id
FROM ' . ATTACHMENTS_TABLE . ' a, ' . POSTS_TABLE . " p
WHERE p.topic_id = $topic_id
- AND p.post_approved = 1
- AND p.topic_id = a.topic_id";
+ AND p.post_visibility = " . ITEM_APPROVED . '
+ AND p.topic_id = a.topic_id';
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -1502,6 +1509,62 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
$l_edited_by = '';
}
+ // Deleting information
+ if ($row['post_visibility'] == ITEM_DELETED && $row['post_delete_user'])
+ {
+ // Get usernames for all following posts if not already stored
+ if (!sizeof($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']]))))
+ {
+ // Remove all post_ids already parsed (we do not have to check them)
+ $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i);
+
+ $sql = 'SELECT DISTINCT u.user_id, u.username, u.user_colour
+ FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
+ WHERE ' . $db->sql_in_set('p.post_id', $post_storage_list) . '
+ AND p.post_delete_user <> 0
+ AND p.post_delete_user = u.user_id';
+ $result2 = $db->sql_query($sql);
+ while ($user_delete_row = $db->sql_fetchrow($result2))
+ {
+ $post_delete_list[$user_delete_row['user_id']] = $user_delete_row;
+ }
+ $db->sql_freeresult($result2);
+
+ unset($post_storage_list);
+ }
+
+ if ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']]))
+ {
+ $user_cache[$row['post_delete_user']] = $post_delete_list[$row['post_delete_user']];
+ }
+
+ $display_postername = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']);
+
+ // User having deleted the post also being the post author?
+ if (!$row['post_delete_user'] || $row['post_delete_user'] == $poster_id)
+ {
+ $display_username = $display_postername;
+ }
+ else
+ {
+ $display_username = get_username_string('full', $row['post_delete_user'], $user_cache[$row['post_delete_user']]['username'], $user_cache[$row['post_delete_user']]['user_colour']);
+ }
+
+ if ($row['post_delete_reason'])
+ {
+ $l_deleted_message = $user->lang('POST_DELETED_BY_REASON', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true), $row['post_delete_reason']);
+ }
+ else
+ {
+ $l_deleted_message = $user->lang('POST_DELETED_BY', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true));
+ }
+ $l_deleted_by = $user->lang('DELETED_INFORMATION', $display_username, $user->format_date($row['post_delete_time'], false, true));
+ }
+ else
+ {
+ $l_deleted_by = $l_deleted_message = '';
+ }
+
// Bump information
if ($topic_data['topic_bumped'] && $row['post_id'] == $topic_data['topic_last_post_id'] && isset($user_cache[$topic_data['topic_bumper']]) )
{
@@ -1538,9 +1601,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])
)));
- $delete_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || (
+ $delete_allowed = ($user->data['is_registered'] && (($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('m_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) || (
$user->data['user_id'] == $poster_id &&
- $auth->acl_get('f_delete', $forum_id) &&
+ ($auth->acl_get('f_delete', $forum_id) || ($auth->acl_get('f_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) &&
$topic_data['topic_last_post_id'] == $row['post_id'] &&
($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) &&
// we do not want to allow removal of the last post if a moderator locked it!
@@ -1570,6 +1633,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '',
'EDITED_MESSAGE' => $l_edited_by,
'EDIT_REASON' => $row['post_edit_reason'],
+ 'DELETED_MESSAGE' => $l_deleted_by,
+ 'DELETE_REASON' => $row['post_delete_reason'],
'BUMPED_MESSAGE' => $l_bumped_by,
'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'),
@@ -1596,10 +1661,11 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'U_YIM' => $user_cache[$poster_id]['yim'],
'U_JABBER' => $user_cache[$poster_id]['jabber'],
- 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&amp;p={$row['post_id']}&amp;f=$forum_id"),
+ 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&amp;p={$row['post_id']}&amp;f=$forum_id&amp;redirect=" . urlencode(str_replace('&amp;', '&', $viewtopic_url . '&amp;p=' . $row['post_id'] . '#p' . $row['post_id']))),
'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&amp;p=' . $row['post_id']) : '',
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '',
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '',
+ 'U_MCP_RESTORE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=' . (($topic_data['topic_visibility'] != ITEM_DELETED) ? 'deleted_posts' : 'deleted_topics') . '&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '',
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'],
'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '',
'U_PREV_POST_ID' => $prev_post_id,
@@ -1612,7 +1678,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1,
- 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true,
+ 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED) ? true : false,
+ 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false,
+ 'L_POST_DELETED_MESSAGE' => $l_deleted_message,
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false,
'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'],
'S_FRIEND' => ($row['friend']) ? true : false,
@@ -1621,8 +1689,10 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false,
'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false,
- 'S_IGNORE_POST' => ($row['hide_post']) ? true : false,
- 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '<a href="' . $viewtopic_url . "&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}" . '">', '</a>') : '',
+ 'S_IGNORE_POST' => ($row['foe']) ? true : false,
+ 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '',
+ 'S_POST_HIDDEN' => $row['hide_post'],
+ 'L_POST_DISPLAY' => ($row['hide_post']) ? $user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $row['post_id'] . '" href="' . $viewtopic_url . "&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}" . '">', '</a>') : '',
);
$user_poster_data = $user_cache[$poster_id];
diff --git a/phpunit.xml.all b/phpunit.xml.all
index 3639843771..d18518d3e3 100644
--- a/phpunit.xml.all
+++ b/phpunit.xml.all
@@ -14,6 +14,10 @@
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">./tests/</directory>
+ <exclude>tests/lint_test.php</exclude>
+ </testsuite>
+ <testsuite name="phpBB Lint Test">
+ <file>tests/lint_test.php</file>
</testsuite>
</testsuites>
@@ -23,9 +27,10 @@
</blacklist>
<whitelist>
<directory suffix=".php">./phpBB/includes/</directory>
+ <directory suffix=".php">./phpBB/phpbb/</directory>
<exclude>
- <file>./phpBB/includes/search/fulltext_native.php</file>
- <file>./phpBB/includes/search/fulltext_mysql.php</file>
+ <file>./phpBB/phpbb/search/fulltext_native.php</file>
+ <file>./phpBB/phpbb/search/fulltext_mysql.php</file>
<directory suffix=".php">./phpBB/includes/captcha/</directory>
</exclude>
</whitelist>
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index f1cb4b9d09..c852f91b50 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -14,6 +14,10 @@
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">./tests/</directory>
+ <exclude>tests/lint_test.php</exclude>
+ </testsuite>
+ <testsuite name="phpBB Lint Test">
+ <file>tests/lint_test.php</file>
</testsuite>
</testsuites>
@@ -30,9 +34,10 @@
</blacklist>
<whitelist>
<directory suffix=".php">./phpBB/includes/</directory>
+ <directory suffix=".php">./phpBB/phpbb/</directory>
<exclude>
- <file>./phpBB/includes/search/fulltext_native.php</file>
- <file>./phpBB/includes/search/fulltext_mysql.php</file>
+ <file>./phpBB/phpbb/search/fulltext_native.php</file>
+ <file>./phpBB/phpbb/search/fulltext_mysql.php</file>
<directory suffix=".php">./phpBB/includes/captcha/</directory>
</exclude>
</whitelist>
diff --git a/phpunit.xml.functional b/phpunit.xml.functional
index 99f11477aa..cd9cc8771f 100644
--- a/phpunit.xml.functional
+++ b/phpunit.xml.functional
@@ -14,6 +14,10 @@
<testsuites>
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">./tests/</directory>
+ <exclude>tests/lint_test.php</exclude>
+ </testsuite>
+ <testsuite name="phpBB Lint Test">
+ <file>tests/lint_test.php</file>
</testsuite>
</testsuites>
@@ -29,9 +33,10 @@
</blacklist>
<whitelist>
<directory suffix=".php">./phpBB/includes/</directory>
+ <directory suffix=".php">./phpBB/phpbb/</directory>
<exclude>
- <file>./phpBB/includes/search/fulltext_native.php</file>
- <file>./phpBB/includes/search/fulltext_mysql.php</file>
+ <file>./phpBB/phpbb/search/fulltext_native.php</file>
+ <file>./phpBB/phpbb/search/fulltext_mysql.php</file>
<directory suffix=".php">./phpBB/includes/captcha/</directory>
</exclude>
</whitelist>
diff --git a/tests/acp_board/auth_provider/invalid.php b/tests/acp_board/auth_provider/invalid.php
new file mode 100644
index 0000000000..c12851afe6
--- /dev/null
+++ b/tests/acp_board/auth_provider/invalid.php
@@ -0,0 +1,13 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_auth_provider_acp_board_invalid
+{
+
+}
diff --git a/tests/acp_board/auth_provider/valid.php b/tests/acp_board/auth_provider/valid.php
new file mode 100644
index 0000000000..42b14cb0af
--- /dev/null
+++ b/tests/acp_board/auth_provider/valid.php
@@ -0,0 +1,16 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_auth_provider_acp_board_valid extends phpbb_auth_provider_base
+{
+ public function login($username, $password)
+ {
+ return;
+ }
+}
diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php
new file mode 100644
index 0000000000..91aa5d1232
--- /dev/null
+++ b/tests/acp_board/select_auth_method_test.php
@@ -0,0 +1,48 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_board.php';
+require_once dirname(__FILE__) . '/auth_provider/invalid.php';
+require_once dirname(__FILE__) . '/auth_provider/valid.php';
+
+class phpbb_acp_board_select_auth_method_test extends phpbb_test_case
+{
+ protected $acp_board;
+
+ public static function select_auth_method_data()
+ {
+ return array(
+ array('acp_board_valid', '<option value="acp_board_valid" selected="selected">Acp_board_valid</option>'),
+ array('acp_board_invalid', '<option value="acp_board_valid">Acp_board_valid</option>'),
+ );
+ }
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ global $phpbb_container;
+ $phpbb_container = new phpbb_mock_container_builder();
+
+ $phpbb_container->set('auth.provider_collection', array(
+ 'auth.provider.acp_board_valid' => new phpbb_auth_provider_acp_board_valid,
+ 'auth.provider.acp_board_invalid' => new phpbb_auth_provider_acp_board_invalid,
+ ));
+
+ $this->acp_board = new acp_board();
+ }
+
+ /**
+ * @dataProvider select_auth_method_data
+ */
+ public function test_select_auth_method($selected, $expected)
+ {
+ $this->assertEquals($expected, $this->acp_board->select_auth_method($selected));
+ }
+}
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php
index cb895b521a..4ebe79c9cd 100644
--- a/tests/avatar/manager_test.php
+++ b/tests/avatar/manager_test.php
@@ -19,24 +19,35 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
$this->phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$this->phpbb_container->expects($this->any())
->method('get')
- ->with('avatar.driver.foobar')->will($this->returnValue('avatar.driver.foobar'));
+ ->will($this->returnArgument(0));
// Prepare dependencies for avatar manager and driver
$config = new phpbb_config(array());
$request = $this->getMock('phpbb_request');
$cache = $this->getMock('phpbb_cache_driver_interface');
+ // $this->avatar_foobar will be needed later on
$this->avatar_foobar = $this->getMock('phpbb_avatar_driver_foobar', array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache));
$this->avatar_foobar->expects($this->any())
- ->method('get_name')
- ->will($this->returnValue('avatar.driver.foobar'));
+ ->method('get_name')
+ ->will($this->returnValue('avatar.driver.foobar'));
+ // barfoo driver can't be mocked with constructor arguments
$this->avatar_barfoo = $this->getMock('phpbb_avatar_driver_barfoo', array('get_name'));
$this->avatar_barfoo->expects($this->any())
- ->method('get_name')
- ->will($this->returnValue('avatar.driver.barfoo'));
-
+ ->method('get_name')
+ ->will($this->returnValue('avatar.driver.barfoo'));
$avatar_drivers = array($this->avatar_foobar, $this->avatar_barfoo);
+ foreach ($this->avatar_drivers() as $driver)
+ {
+ $cur_avatar = $this->getMock('phpbb_avatar_driver_' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache));
+ $cur_avatar->expects($this->any())
+ ->method('get_name')
+ ->will($this->returnValue('avatar.driver.' . $driver));
+ $config['allow_avatar_' . get_class($cur_avatar)] = false;
+ $avatar_drivers[] = $cur_avatar;
+ }
+
$config['allow_avatar_' . get_class($this->avatar_foobar)] = true;
$config['allow_avatar_' . get_class($this->avatar_barfoo)] = false;
@@ -44,28 +55,27 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
$this->manager = new phpbb_avatar_manager($config, $avatar_drivers, $this->phpbb_container);
}
- public function test_get_driver()
+ protected function avatar_drivers()
{
- $driver = $this->manager->get_driver('avatar.driver.foobar', false);
- $this->assertEquals('avatar.driver.foobar', $driver);
-
- $driver = $this->manager->get_driver('avatar.driver.foo_wrong', false);
- $this->assertNull($driver);
-
- $driver = $this->manager->get_driver('avatar.driver.foobar');
- $this->assertEquals('avatar.driver.foobar', $driver);
-
- $driver = $this->manager->get_driver('avatar.driver.foo_wrong');
- $this->assertNull($driver);
+ return array(
+ 'local',
+ 'upload',
+ 'remote',
+ 'gravatar',
+ );
}
public function test_get_all_drivers()
{
$drivers = $this->manager->get_all_drivers();
- $this->assertArrayHasKey('avatar.driver.foobar', $drivers);
- $this->assertArrayHasKey('avatar.driver.barfoo', $drivers);
- $this->assertEquals('avatar.driver.foobar', $drivers['avatar.driver.foobar']);
- $this->assertEquals('avatar.driver.barfoo', $drivers['avatar.driver.barfoo']);
+ $this->assertEquals(array(
+ 'avatar.driver.barfoo' => 'avatar.driver.barfoo',
+ 'avatar.driver.foobar' => 'avatar.driver.foobar',
+ 'avatar.driver.local' => 'avatar.driver.local',
+ 'avatar.driver.remote' => 'avatar.driver.remote',
+ 'avatar.driver.upload' => 'avatar.driver.upload',
+ 'avatar.driver.gravatar' => 'avatar.driver.gravatar',
+ ), $drivers);
}
public function test_get_enabled_drivers()
@@ -76,6 +86,48 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
$this->assertEquals('avatar.driver.foobar', $drivers['avatar.driver.foobar']);
}
+ public function get_driver_data_enabled()
+ {
+ return array(
+ array('avatar.driver.foobar', 'avatar.driver.foobar'),
+ array('avatar.driver.foo_wrong', null),
+ array('avatar.driver.local', null),
+ array(AVATAR_GALLERY, null),
+ array(AVATAR_UPLOAD, null),
+ array(AVATAR_REMOTE, null),
+ );
+ }
+
+ /**
+ * @dataProvider get_driver_data_enabled
+ */
+ public function test_get_driver_enabled($driver_name, $expected)
+ {
+ $driver = $this->manager->get_driver($driver_name);
+ $this->assertEquals($expected, $driver);
+ }
+
+ public function get_driver_data_all()
+ {
+ return array(
+ array('avatar.driver.foobar', 'avatar.driver.foobar'),
+ array('avatar.driver.foo_wrong', null),
+ array('avatar.driver.local', 'avatar.driver.local'),
+ array(AVATAR_GALLERY, 'avatar.driver.local'),
+ array(AVATAR_UPLOAD, 'avatar.driver.upload'),
+ array(AVATAR_REMOTE, 'avatar.driver.remote'),
+ );
+ }
+
+ /**
+ * @dataProvider get_driver_data_all
+ */
+ public function test_get_driver_all($driver_name, $expected)
+ {
+ $driver = $this->manager->get_driver($driver_name, false);
+ $this->assertEquals($expected, $driver);
+ }
+
public function test_get_avatar_settings()
{
$avatar_settings = $this->manager->get_avatar_settings($this->avatar_foobar);
@@ -157,4 +209,38 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
$this->assertArrayHasKey($key, $cleaned_row);
}
}
+
+ public function test_clean_driver_name()
+ {
+ $this->assertEquals('avatar.driver.local', $this->manager->clean_driver_name('avatar_driver_local'));
+ }
+
+ public function test_prepare_driver_name()
+ {
+ $this->assertEquals('avatar_driver_local', $this->manager->prepare_driver_name('avatar.driver.local'));
+ }
+
+ public function test_localize_errors()
+ {
+ $user = $this->getMock('phpbb_user');
+ $lang_array = array(
+ array('FOOBAR_OFF', 'foobar_off'),
+ array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'),
+ );
+ $user->expects($this->any())
+ ->method('lang')
+ ->will($this->returnValueMap($lang_array));
+
+ // Pass error as string
+ $this->assertEquals(array('foobar_off'), $this->manager->localize_errors($user, array('FOOBAR_OFF')));
+
+ // Pass error as array for vsprintf()
+ $this->assertEquals(array('FOOBAR_EXPLAIN foo'), $this->manager->localize_errors($user, array(array('FOOBAR_EXPLAIN', 'foo'))));
+
+ // Pass both types
+ $this->assertEquals(array('foobar_off', 'FOOBAR_EXPLAIN foo'), $this->manager->localize_errors($user, array(
+ 'FOOBAR_OFF',
+ array('FOOBAR_EXPLAIN', 'foo'),
+ )));
+ }
}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index a38740c82d..68cbb64c03 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -14,13 +14,13 @@ require_once $phpbb_root_path . 'includes/startup.php';
$table_prefix = 'phpbb_';
require_once $phpbb_root_path . 'includes/constants.php';
-require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx;
+require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx;
$phpbb_class_loader_mock = new phpbb_class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php");
$phpbb_class_loader_mock->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', "php");
$phpbb_class_loader_ext->register();
-$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', "php");
+$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'phpbb/', "php");
$phpbb_class_loader->register();
require_once 'test_framework/phpbb_test_case_helpers.php';
diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php
index bf27c7c217..2b55c1ff8d 100644
--- a/tests/class_loader/class_loader_test.php
+++ b/tests/class_loader/class_loader_test.php
@@ -30,9 +30,9 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
public function test_resolve_path()
{
$prefix = dirname(__FILE__) . '/';
- $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/');
+ $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/');
- $prefix .= 'includes/';
+ $prefix .= 'phpbb/';
$this->assertEquals(
'',
@@ -71,10 +71,10 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
$cache = new phpbb_mock_cache($cache_map);
$prefix = dirname(__FILE__) . '/';
- $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/', 'php', $cache);
- $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'includes/', 'php', $cache);
+ $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/', 'php', $cache);
+ $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'phpbb/', 'php', $cache);
- $prefix .= 'includes/';
+ $prefix .= 'phpbb/';
$this->assertEquals(
$prefix . 'dir/class_name.php',
diff --git a/tests/class_loader/includes/class_name.php b/tests/class_loader/phpbb/class_name.php
index e941173cdd..e941173cdd 100644
--- a/tests/class_loader/includes/class_name.php
+++ b/tests/class_loader/phpbb/class_name.php
diff --git a/tests/class_loader/includes/dir.php b/tests/class_loader/phpbb/dir.php
index 1c8930d8e7..1c8930d8e7 100644
--- a/tests/class_loader/includes/dir.php
+++ b/tests/class_loader/phpbb/dir.php
diff --git a/tests/class_loader/includes/dir/class_name.php b/tests/class_loader/phpbb/dir/class_name.php
index 0675aa8fc5..0675aa8fc5 100644
--- a/tests/class_loader/includes/dir/class_name.php
+++ b/tests/class_loader/phpbb/dir/class_name.php
diff --git a/tests/class_loader/includes/dir/subdir/class_name.php b/tests/class_loader/phpbb/dir/subdir/class_name.php
index 7321a609cc..7321a609cc 100644
--- a/tests/class_loader/includes/dir/subdir/class_name.php
+++ b/tests/class_loader/phpbb/dir/subdir/class_name.php
diff --git a/tests/class_loader/includes/dir2/dir2.php b/tests/class_loader/phpbb/dir2/dir2.php
index 01cf4086ff..01cf4086ff 100644
--- a/tests/class_loader/includes/dir2/dir2.php
+++ b/tests/class_loader/phpbb/dir2/dir2.php
diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php
new file mode 100644
index 0000000000..6234aac9ad
--- /dev/null
+++ b/tests/content_visibility/delete_post_test.php
@@ -0,0 +1,310 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_posting.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
+require_once dirname(__FILE__) . '/../mock/search.php';
+
+class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/delete_post.xml');
+ }
+
+ public function delete_post_data()
+ {
+ $info_data = array(
+ 'topic_first_post_id' => 1,
+ 'topic_last_post_id' => 3,
+ 'topic_posts_approved' => 3,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 0,
+ 'topic_visibility' => ITEM_APPROVED,
+ 'post_time' => 2,
+ 'post_visibility' => ITEM_APPROVED,
+ 'post_postcount' => true,
+ 'poster_id' => 1,
+ 'post_reported' => false,
+ );
+
+ return array(
+ array(
+ 1, 1, 2,
+ array_merge($info_data, array(
+ 'post_time' => 2,
+ )),
+ false, 'harddelete',
+ array(
+ array('post_id' => 1, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ //array('post_id' => 2, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ array('post_id' => 3, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ ),
+ array(
+ array(
+ 'topic_visibility' => ITEM_APPROVED,
+ 'topic_first_post_id' => 1,
+ 'topic_last_post_id' => 3,
+ 'topic_posts_approved' => 2,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 0,
+ 'topic_delete_reason' => '',
+ ),
+ ),
+ array(
+ array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
+ ),
+ ),
+ array(
+ 1, 1, 1,
+ array_merge($info_data, array(
+ 'post_time' => 1,
+ )),
+ false, 'harddelete',
+ array(
+ //array('post_id' => 1, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ array('post_id' => 2, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ array('post_id' => 3, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ ),
+ array(
+ array(
+ 'topic_visibility' => ITEM_APPROVED,
+ 'topic_first_post_id' => 2,
+ 'topic_last_post_id' => 3,
+ 'topic_posts_approved' => 2,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 0,
+ 'topic_delete_reason' => '',
+ ),
+ ),
+ array(
+ array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
+ ),
+ ),
+ array(
+ 1, 1, 3,
+ array_merge($info_data, array(
+ 'post_time' => 3,
+ )),
+ false, 'harddelete',
+ array(
+ array('post_id' => 1, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ array('post_id' => 2, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ //array('post_id' => 3, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ ),
+ array(
+ array(
+ 'topic_visibility' => ITEM_APPROVED,
+ 'topic_first_post_id' => 1,
+ 'topic_last_post_id' => 2,
+ 'topic_posts_approved' => 2,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 0,
+ 'topic_delete_reason' => '',
+ ),
+ ),
+ array(
+ array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2),
+ ),
+ ),
+ array(
+ 1, 1, 2,
+ array_merge($info_data, array(
+ 'post_time' => 2,
+ )),
+ true, 'soft delete',
+ array(
+ array('post_id' => 1, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ array('post_id' => 2, 'post_visibility' => ITEM_DELETED, 'post_delete_reason' => 'soft delete'),
+ array('post_id' => 3, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ ),
+ array(
+ array(
+ 'topic_visibility' => ITEM_APPROVED,
+ 'topic_first_post_id' => 1,
+ 'topic_last_post_id' => 3,
+ 'topic_posts_approved' => 2,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 1,
+ 'topic_delete_reason' => '',
+ ),
+ ),
+ array(
+ array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
+ ),
+ ),
+ array(
+ 1, 1, 1,
+ array_merge($info_data, array(
+ 'post_time' => 1,
+ )),
+ true, 'soft delete',
+ array(
+ array('post_id' => 1, 'post_visibility' => ITEM_DELETED, 'post_delete_reason' => 'soft delete'),
+ array('post_id' => 2, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ array('post_id' => 3, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ ),
+ array(
+ array(
+ 'topic_visibility' => ITEM_APPROVED,
+ 'topic_first_post_id' => 2,
+ 'topic_last_post_id' => 3,
+ 'topic_posts_approved' => 2,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 1,
+ 'topic_delete_reason' => '',
+ ),
+ ),
+ array(
+ array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
+ ),
+ ),
+ array(
+ 1, 1, 3,
+ array_merge($info_data, array(
+ 'post_time' => 3,
+ )),
+ true, 'soft delete',
+ array(
+ array('post_id' => 1, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ array('post_id' => 2, 'post_visibility' => ITEM_APPROVED, 'post_delete_reason' => ''),
+ array('post_id' => 3, 'post_visibility' => ITEM_DELETED, 'post_delete_reason' => 'soft delete'),
+ ),
+ array(
+ array(
+ 'topic_visibility' => ITEM_APPROVED,
+ 'topic_first_post_id' => 1,
+ 'topic_last_post_id' => 2,
+ 'topic_posts_approved' => 2,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 1,
+ 'topic_delete_reason' => '',
+ ),
+ ),
+ array(
+ array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2),
+ ),
+ ),
+
+ array(
+ 2, 2, 4,
+ array(
+ 'topic_first_post_id' => 4,
+ 'topic_last_post_id' => 4,
+ 'topic_posts_approved' => 1,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 0,
+ 'topic_visibility' => ITEM_APPROVED,
+ 'post_time' => 4,
+ 'post_visibility' => ITEM_APPROVED,
+ 'post_postcount' => true,
+ 'poster_id' => 1,
+ 'post_reported' => false,
+ ),
+ false, 'harddelete',
+ array(
+ ),
+ array(
+ ),
+ array(
+ array('forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 0),
+ ),
+ ),
+
+ array(
+ 2, 2, 4,
+ array(
+ 'topic_first_post_id' => 4,
+ 'topic_last_post_id' => 4,
+ 'topic_posts_approved' => 1,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 0,
+ 'topic_visibility' => ITEM_APPROVED,
+ 'post_time' => 4,
+ 'post_visibility' => ITEM_APPROVED,
+ 'post_postcount' => true,
+ 'poster_id' => 1,
+ 'post_reported' => false,
+ ),
+ true, 'soft delete',
+ array(
+ array('post_id' => 4, 'post_visibility' => ITEM_DELETED, 'post_delete_reason' => ''),
+ ),
+ array(
+ array(
+ 'topic_visibility' => ITEM_DELETED,
+ 'topic_first_post_id' => 4,
+ 'topic_last_post_id' => 4,
+ 'topic_posts_approved' => 0,
+ 'topic_posts_unapproved' => 0,
+ 'topic_posts_softdeleted' => 1,
+ 'topic_delete_reason' => 'soft delete',
+ ),
+ ),
+ array(
+ array('forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 1, 'forum_last_post_id' => 0),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider delete_post_data
+ */
+ public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum)
+ {
+ global $auth, $cache, $config, $db, $phpbb_container, $phpbb_root_path, $phpEx;
+
+ $config['search_type'] = 'phpbb_mock_search';
+ $cache = new phpbb_mock_cache;
+ $db = $this->new_dbal();
+ set_config_count(null, null, null, new phpbb_config(array('num_posts' => 3, 'num_topics' => 1)));
+
+ // Create auth mock
+ $auth = $this->getMock('phpbb_auth');
+ $auth->expects($this->any())
+ ->method('acl_get')
+ ->with($this->stringContains('_'), $this->anything())
+ ->will($this->returnValueMap(array(
+ array('m_approve', 1, true),
+ )));
+ $user = $this->getMock('phpbb_user');
+
+ $phpbb_container = new phpbb_mock_container_builder();
+ $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager());
+ $phpbb_container->set('content.visibility', new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
+
+ delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason);
+
+ $result = $db->sql_query('SELECT post_id, post_visibility, post_delete_reason
+ FROM phpbb_posts
+ WHERE topic_id = ' . $topic_id . '
+ ORDER BY post_id ASC');
+
+ $this->assertEquals($expected_posts, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
+
+ $result = $db->sql_query('SELECT topic_visibility, topic_first_post_id, topic_last_post_id, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_delete_reason
+ FROM phpbb_topics
+ WHERE topic_id = ' . $topic_id);
+
+ $this->assertEquals($expected_topic, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
+
+ $result = $db->sql_query('SELECT forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id
+ FROM phpbb_forums
+ WHERE forum_id = ' . $forum_id);
+
+ $this->assertEquals($expected_forum, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
+ }
+}
diff --git a/tests/content_visibility/fixtures/delete_post.xml b/tests/content_visibility/fixtures/delete_post.xml
new file mode 100644
index 0000000000..deca9c74b6
--- /dev/null
+++ b/tests/content_visibility/fixtures/delete_post.xml
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_forums">
+ <column>forum_id</column>
+ <column>forum_posts_approved</column>
+ <column>forum_posts_unapproved</column>
+ <column>forum_posts_softdeleted</column>
+ <column>forum_topics_approved</column>
+ <column>forum_topics_unapproved</column>
+ <column>forum_topics_softdeleted</column>
+ <column>forum_last_post_id</column>
+ <column>forum_parents</column>
+ <column>forum_desc</column>
+ <column>forum_rules</column>
+
+ <row>
+ <value>1</value>
+ <value>3</value>
+ <value>0</value>
+ <value>0</value>
+ <value>1</value>
+ <value>0</value>
+ <value>0</value>
+ <value>3</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>1</value>
+ <value>0</value>
+ <value>0</value>
+ <value>1</value>
+ <value>0</value>
+ <value>0</value>
+ <value>4</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+ <table name="phpbb_topics">
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>topic_visibility</column>
+ <column>topic_title</column>
+ <column>topic_first_post_id</column>
+ <column>topic_last_post_id</column>
+ <column>topic_delete_user</column>
+ <column>topic_delete_time</column>
+ <column>topic_delete_reason</column>
+ <column>topic_posts_approved</column>
+ <column>topic_posts_unapproved</column>
+ <column>topic_posts_softdeleted</column>
+
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ <value>1</value>
+ <value>3</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ <value>3</value>
+ <value>0</value>
+ <value>0</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>2</value>
+ <value>1</value>
+ <value>Approved</value>
+ <value>4</value>
+ <value>4</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ <value>1</value>
+ <value>0</value>
+ <value>0</value>
+ </row>
+ </table>
+ <table name="phpbb_posts">
+ <column>post_id</column>
+ <column>poster_id</column>
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>post_visibility</column>
+ <column>post_time</column>
+ <column>post_text</column>
+ <column>post_delete_user</column>
+ <column>post_delete_time</column>
+ <column>post_delete_reason</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Approved</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>3</value>
+ <value>Approved</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ </row>
+
+ <row>
+ <value>4</value>
+ <value>1</value>
+ <value>2</value>
+ <value>2</value>
+ <value>1</value>
+ <value>4</value>
+ <value>Approved</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ </row>
+ </table>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>user_posts</column>
+ <column>username</column>
+ <column>username_clean</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>1</value>
+ <value>4</value>
+ <value>user 1</value>
+ <value>user 1</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/content_visibility/fixtures/get_forums_visibility_sql.xml b/tests/content_visibility/fixtures/get_forums_visibility_sql.xml
new file mode 100644
index 0000000000..658d34398f
--- /dev/null
+++ b/tests/content_visibility/fixtures/get_forums_visibility_sql.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_topics">
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>topic_visibility</column>
+ <column>topic_title</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+ <row>
+ <value>4</value>
+ <value>2</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>2</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>6</value>
+ <value>2</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+ <row>
+ <value>7</value>
+ <value>3</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>8</value>
+ <value>3</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>9</value>
+ <value>3</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+ </table>
+ <table name="phpbb_posts">
+ <column>post_id</column>
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>post_visibility</column>
+ <column>post_text</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>3</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+ <row>
+ <value>4</value>
+ <value>4</value>
+ <value>2</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>5</value>
+ <value>2</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>6</value>
+ <value>6</value>
+ <value>2</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+ <row>
+ <value>7</value>
+ <value>7</value>
+ <value>3</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>8</value>
+ <value>8</value>
+ <value>3</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>9</value>
+ <value>9</value>
+ <value>3</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/content_visibility/fixtures/get_visibility_sql.xml b/tests/content_visibility/fixtures/get_visibility_sql.xml
new file mode 100644
index 0000000000..146244263e
--- /dev/null
+++ b/tests/content_visibility/fixtures/get_visibility_sql.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_topics">
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>topic_visibility</column>
+ <column>topic_title</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+ </table>
+ <table name="phpbb_posts">
+ <column>post_id</column>
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>post_visibility</column>
+ <column>post_text</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>3</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/content_visibility/fixtures/set_post_visibility.xml b/tests/content_visibility/fixtures/set_post_visibility.xml
new file mode 100644
index 0000000000..722525deaa
--- /dev/null
+++ b/tests/content_visibility/fixtures/set_post_visibility.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_topics">
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>topic_visibility</column>
+ <column>topic_title</column>
+ <column>topic_first_post_id</column>
+ <column>topic_last_post_id</column>
+ <column>topic_posts_approved</column>
+ <column>topic_posts_softdeleted</column>
+ <column>topic_posts_unapproved</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ <value>2</value>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ </row>
+
+ <row>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>2 Approved posts</value>
+ <value>5</value>
+ <value>6</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ </row>
+
+ <row>
+ <value>3</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Only 1 Approved posts</value>
+ <value>8</value>
+ <value>8</value>
+ <value>1</value>
+ <value>0</value>
+ <value>0</value>
+ </row>
+ </table>
+ <table name="phpbb_posts">
+ <column>post_id</column>
+ <column>poster_id</column>
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>post_visibility</column>
+ <column>post_text</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>3</value>
+ <value>1</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+
+ <row>
+ <value>4</value>
+ <value>1</value>
+ <value>2</value>
+ <value>1</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>2</value>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ <row>
+ <value>6</value>
+ <value>2</value>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved 2</value>
+ </row>
+ <row>
+ <value>7</value>
+ <value>3</value>
+ <value>2</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Softdeleted</value>
+ </row>
+ <row>
+ <value>8</value>
+ <value>1</value>
+ <value>3</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ </row>
+ </table>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>user_posts</column>
+ <column>username</column>
+ <column>username_clean</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>user 1</value>
+ <value>user 1</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>1</value>
+ <value>user 2</value>
+ <value>user 2</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>1</value>
+ <value>user 3</value>
+ <value>user 3</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/content_visibility/fixtures/set_topic_visibility.xml b/tests/content_visibility/fixtures/set_topic_visibility.xml
new file mode 100644
index 0000000000..a875012d4f
--- /dev/null
+++ b/tests/content_visibility/fixtures/set_topic_visibility.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_topics">
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>topic_visibility</column>
+ <column>topic_title</column>
+ <column>topic_first_post_id</column>
+ <column>topic_last_post_id</column>
+ <column>topic_delete_user</column>
+ <column>topic_delete_time</column>
+ <column>topic_delete_reason</column>
+
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ <value>1</value>
+ <value>1</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ </row>
+
+ <row>
+ <value>2</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Soft deleted</value>
+ <value>4</value>
+ <value>5</value>
+ <value>2</value>
+ <value>123</value>
+ <value></value>
+ </row>
+ </table>
+ <table name="phpbb_posts">
+ <column>post_id</column>
+ <column>poster_id</column>
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>post_visibility</column>
+ <column>post_text</column>
+ <column>post_delete_user</column>
+ <column>post_delete_time</column>
+ <column>post_delete_reason</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Approved</value>
+ <value>2</value>
+ <value>0</value>
+ <value></value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Soft deleted</value>
+ <value>2</value>
+ <value>123</value>
+ <value>manually</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>0</value>
+ <value>Unapproved</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ </row>
+
+ <row>
+ <value>4</value>
+ <value>1</value>
+ <value>2</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Soft deleted by topic soft delete</value>
+ <value>2</value>
+ <value>123</value>
+ <value></value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>1</value>
+ <value>2</value>
+ <value>1</value>
+ <value>2</value>
+ <value>Soft deleted before the topic was soft deleted</value>
+ <value>2</value>
+ <value>120</value>
+ <value>manually</value>
+ </row>
+ <row>
+ <value>6</value>
+ <value>1</value>
+ <value>2</value>
+ <value>1</value>
+ <value>0</value>
+ <value>Unapproved before the topic was soft deleted</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ </row>
+ </table>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>user_posts</column>
+ <column>username</column>
+ <column>username_clean</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>1</value>
+ <value>6</value>
+ <value>user 1</value>
+ <value>user 1</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php
new file mode 100644
index 0000000000..aa44fa4013
--- /dev/null
+++ b/tests/content_visibility/get_forums_visibility_sql_test.php
@@ -0,0 +1,143 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/get_forums_visibility_sql.xml');
+ }
+
+ public function get_forums_visibility_sql_data()
+ {
+ return array(
+ array(
+ 'phpbb_topics',
+ 'topic', array(1, 2, 3), '',
+ array(
+ array('m_approve', true, array(1 => true, 2 => true, 3 => true)),
+ ),
+ array(
+ array('topic_id' => 1),
+ array('topic_id' => 2),
+ array('topic_id' => 3),
+ array('topic_id' => 4),
+ array('topic_id' => 5),
+ array('topic_id' => 6),
+ array('topic_id' => 7),
+ array('topic_id' => 8),
+ array('topic_id' => 9),
+ ),
+ ),
+ array(
+ 'phpbb_topics',
+ 'topic', array(1, 2), '',
+ array(
+ array('m_approve', true, array(1 => true, 2 => true, 3 => true)),
+ ),
+ array(
+ array('topic_id' => 1),
+ array('topic_id' => 2),
+ array('topic_id' => 3),
+ array('topic_id' => 4),
+ array('topic_id' => 5),
+ array('topic_id' => 6),
+ ),
+ ),
+ array(
+ 'phpbb_topics',
+ 'topic', array(1, 2, 3), '',
+ array(
+ array('m_approve', true, array(2 => true)),
+ ),
+ array(
+ array('topic_id' => 2),
+ array('topic_id' => 4),
+ array('topic_id' => 5),
+ array('topic_id' => 6),
+ array('topic_id' => 8),
+ ),
+ ),
+ array(
+ 'phpbb_posts',
+ 'post', array(1, 2, 3), '',
+ array(
+ array('m_approve', true, array(1 => true, 2 => true, 3 => true)),
+ ),
+ array(
+ array('post_id' => 1),
+ array('post_id' => 2),
+ array('post_id' => 3),
+ array('post_id' => 4),
+ array('post_id' => 5),
+ array('post_id' => 6),
+ array('post_id' => 7),
+ array('post_id' => 8),
+ array('post_id' => 9),
+ ),
+ ),
+ array(
+ 'phpbb_posts',
+ 'post', array(1, 2), '',
+ array(
+ array('m_approve', true, array(1 => true, 2 => true, 3 => true)),
+ ),
+ array(
+ array('post_id' => 1),
+ array('post_id' => 2),
+ array('post_id' => 3),
+ array('post_id' => 4),
+ array('post_id' => 5),
+ array('post_id' => 6),
+ ),
+ ),
+ array(
+ 'phpbb_posts',
+ 'post', array(1, 2, 3), '',
+ array(
+ array('m_approve', true, array(2 => true)),
+ ),
+ array(
+ array('post_id' => 2),
+ array('post_id' => 4),
+ array('post_id' => 5),
+ array('post_id' => 6),
+ array('post_id' => 8),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider get_forums_visibility_sql_data
+ */
+ public function test_get_forums_visibility_sql($table, $mode, $forum_ids, $table_alias, $permissions, $expected)
+ {
+ global $cache, $db, $auth, $phpbb_root_path, $phpEx;
+
+ $cache = new phpbb_mock_cache;
+ $db = $this->new_dbal();
+
+ // Create auth mock
+ $auth = $this->getMock('phpbb_auth');
+ $auth->expects($this->any())
+ ->method('acl_getf')
+ ->with($this->stringContains('_'), $this->anything())
+ ->will($this->returnValueMap($permissions));
+ $user = $this->getMock('phpbb_user');
+ $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+
+ $result = $db->sql_query('SELECT ' . $mode . '_id
+ FROM ' . $table . '
+ WHERE ' . $content_visibility->get_forums_visibility_sql($mode, $forum_ids, $table_alias) . '
+ ORDER BY ' . $mode . '_id ASC');
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+ }
+}
diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php
new file mode 100644
index 0000000000..0f019ffa50
--- /dev/null
+++ b/tests/content_visibility/get_global_visibility_sql_test.php
@@ -0,0 +1,143 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/get_forums_visibility_sql.xml');
+ }
+
+ public function get_global_visibility_sql_data()
+ {
+ return array(
+ array(
+ 'phpbb_topics',
+ 'topic', array(), '',
+ array(
+ array('m_approve', true, array(1 => true, 2 => true, 3 => true)),
+ ),
+ array(
+ array('topic_id' => 1),
+ array('topic_id' => 2),
+ array('topic_id' => 3),
+ array('topic_id' => 4),
+ array('topic_id' => 5),
+ array('topic_id' => 6),
+ array('topic_id' => 7),
+ array('topic_id' => 8),
+ array('topic_id' => 9),
+ ),
+ ),
+ array(
+ 'phpbb_topics',
+ 'topic', array(3), '',
+ array(
+ array('m_approve', true, array(1 => true, 2 => true, 3 => true)),
+ ),
+ array(
+ array('topic_id' => 1),
+ array('topic_id' => 2),
+ array('topic_id' => 3),
+ array('topic_id' => 4),
+ array('topic_id' => 5),
+ array('topic_id' => 6),
+ ),
+ ),
+ array(
+ 'phpbb_topics',
+ 'topic', array(), '',
+ array(
+ array('m_approve', true, array(2 => true)),
+ ),
+ array(
+ array('topic_id' => 2),
+ array('topic_id' => 4),
+ array('topic_id' => 5),
+ array('topic_id' => 6),
+ array('topic_id' => 8),
+ ),
+ ),
+ array(
+ 'phpbb_posts',
+ 'post', array(), '',
+ array(
+ array('m_approve', true, array(1 => true, 2 => true, 3 => true)),
+ ),
+ array(
+ array('post_id' => 1),
+ array('post_id' => 2),
+ array('post_id' => 3),
+ array('post_id' => 4),
+ array('post_id' => 5),
+ array('post_id' => 6),
+ array('post_id' => 7),
+ array('post_id' => 8),
+ array('post_id' => 9),
+ ),
+ ),
+ array(
+ 'phpbb_posts',
+ 'post', array(3), '',
+ array(
+ array('m_approve', true, array(1 => true, 2 => true, 3 => true)),
+ ),
+ array(
+ array('post_id' => 1),
+ array('post_id' => 2),
+ array('post_id' => 3),
+ array('post_id' => 4),
+ array('post_id' => 5),
+ array('post_id' => 6),
+ ),
+ ),
+ array(
+ 'phpbb_posts',
+ 'post', array(), '',
+ array(
+ array('m_approve', true, array(2 => true)),
+ ),
+ array(
+ array('post_id' => 2),
+ array('post_id' => 4),
+ array('post_id' => 5),
+ array('post_id' => 6),
+ array('post_id' => 8),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider get_global_visibility_sql_data
+ */
+ public function test_get_global_visibility_sql($table, $mode, $forum_ids, $table_alias, $permissions, $expected)
+ {
+ global $cache, $db, $auth, $phpbb_root_path, $phpEx;
+
+ $cache = new phpbb_mock_cache;
+ $db = $this->new_dbal();
+
+ // Create auth mock
+ $auth = $this->getMock('phpbb_auth');
+ $auth->expects($this->any())
+ ->method('acl_getf')
+ ->with($this->stringContains('_'), $this->anything())
+ ->will($this->returnValueMap($permissions));
+ $user = $this->getMock('phpbb_user');
+ $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+
+ $result = $db->sql_query('SELECT ' . $mode . '_id
+ FROM ' . $table . '
+ WHERE ' . $content_visibility->get_global_visibility_sql($mode, $forum_ids, $table_alias) . '
+ ORDER BY ' . $mode . '_id ASC');
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+ }
+}
diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php
new file mode 100644
index 0000000000..cc6c10c649
--- /dev/null
+++ b/tests/content_visibility/get_visibility_sql_test.php
@@ -0,0 +1,90 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/get_visibility_sql.xml');
+ }
+
+ public function get_visibility_sql_data()
+ {
+ return array(
+ array(
+ 'phpbb_posts',
+ 'post', 1, '',
+ array(
+ array('m_approve', 1, true),
+ ),
+ array(
+ array('post_id' => 1),
+ array('post_id' => 2),
+ array('post_id' => 3),
+ ),
+ ),
+ array(
+ 'phpbb_posts',
+ 'post', 1, '',
+ array(
+ ),
+ array(
+ array('post_id' => 2),
+ ),
+ ),
+ array(
+ 'phpbb_topics',
+ 'topic', 1, '',
+ array(
+ array('m_approve', 1, true),
+ ),
+ array(
+ array('topic_id' => 1),
+ array('topic_id' => 2),
+ array('topic_id' => 3),
+ ),
+ ),
+ array(
+ 'phpbb_topics',
+ 'topic', 1, '',
+ array(),
+ array(
+ array('topic_id' => 2),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider get_visibility_sql_data
+ */
+ public function test_get_visibility_sql($table, $mode, $forum_id, $table_alias, $permissions, $expected)
+ {
+ global $cache, $db, $auth, $phpbb_root_path, $phpEx;
+
+ $cache = new phpbb_mock_cache;
+ $db = $this->new_dbal();
+
+ // Create auth mock
+ $auth = $this->getMock('phpbb_auth');
+ $auth->expects($this->any())
+ ->method('acl_get')
+ ->with($this->stringContains('_'), $this->anything())
+ ->will($this->returnValueMap($permissions));
+ $user = $this->getMock('phpbb_user');
+ $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+
+ $result = $db->sql_query('SELECT ' . $mode . '_id
+ FROM ' . $table . '
+ WHERE ' . $content_visibility->get_visibility_sql($mode, $forum_id, $table_alias) . '
+ ORDER BY ' . $mode . '_id ASC');
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+ }
+}
diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php
new file mode 100644
index 0000000000..81abf56c75
--- /dev/null
+++ b/tests/content_visibility/set_post_visibility_test.php
@@ -0,0 +1,143 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_posting.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
+
+class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/set_post_visibility.xml');
+ }
+
+ public function set_post_visibility_data()
+ {
+ return array(
+ array(
+ ITEM_APPROVED,
+ 1, 1, 1,
+ 2, time(), 'approve',
+ true, false,
+ array(
+ array('post_id' => 1, 'post_visibility' => 1, 'post_delete_reason' => 'approve'),
+ array('post_id' => 2, 'post_visibility' => 1, 'post_delete_reason' => ''),
+ array('post_id' => 3, 'post_visibility' => 2, 'post_delete_reason' => ''),
+ ),
+ array(
+ array('topic_visibility' => 1, 'topic_first_post_id' => 1, 'topic_last_post_id' => 2),
+ ),
+ ),
+ array(
+ ITEM_APPROVED,
+ 3, 1, 1,
+ 2, time(), 'approve',
+ false, true,
+ array(
+ array('post_id' => 1, 'post_visibility' => 0, 'post_delete_reason' => ''),
+ array('post_id' => 2, 'post_visibility' => 1, 'post_delete_reason' => ''),
+ array('post_id' => 3, 'post_visibility' => 1, 'post_delete_reason' => 'approve'),
+ ),
+ array(
+ array('topic_visibility' => 1, 'topic_first_post_id' => 2, 'topic_last_post_id' => 3),
+ ),
+ ),
+ array(
+ ITEM_DELETED,
+ 2, 1, 1,
+ 2, time(), 'deleted',
+ true, true,
+ array(
+ array('post_id' => 1, 'post_visibility' => 0, 'post_delete_reason' => ''),
+ array('post_id' => 2, 'post_visibility' => 2, 'post_delete_reason' => 'deleted'),
+ array('post_id' => 3, 'post_visibility' => 2, 'post_delete_reason' => ''),
+ ),
+ array(
+ array('topic_visibility' => 2, 'topic_first_post_id' => 1, 'topic_last_post_id' => 3),
+ ),
+ ),
+ array(
+ ITEM_DELETED,
+ 5, 2, 1,
+ 2, time(), 'deleted',
+ true, false,
+ array(
+ array('post_id' => 4, 'post_visibility' => 0, 'post_delete_reason' => ''),
+ array('post_id' => 5, 'post_visibility' => 2, 'post_delete_reason' => 'deleted'),
+ array('post_id' => 6, 'post_visibility' => 1, 'post_delete_reason' => ''),
+ array('post_id' => 7, 'post_visibility' => 2, 'post_delete_reason' => ''),
+ ),
+ array(
+ array('topic_visibility' => 1, 'topic_first_post_id' => 6, 'topic_last_post_id' => 6),
+ ),
+ ),
+ array(
+ ITEM_DELETED,
+ 6, 2, 1,
+ 2, time(), 'deleted',
+ false, true,
+ array(
+ array('post_id' => 4, 'post_visibility' => 0, 'post_delete_reason' => ''),
+ array('post_id' => 5, 'post_visibility' => 1, 'post_delete_reason' => ''),
+ array('post_id' => 6, 'post_visibility' => 2, 'post_delete_reason' => 'deleted'),
+ array('post_id' => 7, 'post_visibility' => 2, 'post_delete_reason' => ''),
+ ),
+ array(
+ array('topic_visibility' => 1, 'topic_first_post_id' => 5, 'topic_last_post_id' => 5),
+ ),
+ ),
+ array(
+ ITEM_DELETED,
+ 8, 3, 1,
+ 2, time(), 'deleted',
+ true, true,
+ array(
+ array('post_id' => 8, 'post_visibility' => 2, 'post_delete_reason' => 'deleted'),
+ ),
+ array(
+ array('topic_visibility' => 2, 'topic_first_post_id' => 8, 'topic_last_post_id' => 8),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider set_post_visibility_data
+ */
+ public function test_set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest, $expected, $expected_topic)
+ {
+ global $cache, $db, $auth, $phpbb_root_path, $phpEx;
+
+ $cache = new phpbb_mock_cache;
+ $db = $this->new_dbal();
+ $auth = $this->getMock('phpbb_auth');
+ $user = $this->getMock('phpbb_user');
+ $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+
+ $content_visibility->set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest);
+
+ $result = $db->sql_query('SELECT post_id, post_visibility, post_delete_reason
+ FROM phpbb_posts
+ WHERE topic_id = ' . $topic_id . '
+ ORDER BY post_id ASC');
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
+
+ $result = $db->sql_query('SELECT topic_visibility, topic_first_post_id, topic_last_post_id
+ FROM phpbb_topics
+ WHERE topic_id = ' . $topic_id);
+
+ $this->assertEquals($expected_topic, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
+ }
+}
diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php
new file mode 100644
index 0000000000..6b5d884a2b
--- /dev/null
+++ b/tests/content_visibility/set_topic_visibility_test.php
@@ -0,0 +1,107 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_posting.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
+
+class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/set_topic_visibility.xml');
+ }
+
+ public function set_topic_visibility_data()
+ {
+ return array(
+ array(
+ ITEM_DELETED, 1, 1,
+ 2, time(), 'delete', false,
+ array(
+ array('post_id' => 1, 'post_visibility' => 2, 'post_delete_reason' => ''),
+ array('post_id' => 2, 'post_visibility' => 2, 'post_delete_reason' => 'manually'),
+ array('post_id' => 3, 'post_visibility' => 0, 'post_delete_reason' => ''),
+ ),
+ array(
+ array('topic_visibility' => 2, 'topic_first_post_id' => 1, 'topic_last_post_id' => 3, 'topic_delete_reason' => 'delete'),
+ ),
+ ),
+ array(
+ ITEM_DELETED, 1, 1,
+ 2, time(), 'delete-forced', true,
+ array(
+ array('post_id' => 1, 'post_visibility' => 2, 'post_delete_reason' => ''),
+ array('post_id' => 2, 'post_visibility' => 2, 'post_delete_reason' => ''),
+ array('post_id' => 3, 'post_visibility' => 2, 'post_delete_reason' => ''),
+ ),
+ array(
+ array('topic_visibility' => 2, 'topic_first_post_id' => 1, 'topic_last_post_id' => 3, 'topic_delete_reason' => 'delete-forced'),
+ ),
+ ),
+ array(
+ ITEM_APPROVED, 2, 1,
+ 2, time(), 'approved', false,
+ array(
+ array('post_id' => 4, 'post_visibility' => 1, 'post_delete_reason' => ''),
+ array('post_id' => 5, 'post_visibility' => 2, 'post_delete_reason' => 'manually'),
+ array('post_id' => 6, 'post_visibility' => 0, 'post_delete_reason' => ''),
+ ),
+ array(
+ array('topic_visibility' => 1, 'topic_first_post_id' => 4, 'topic_last_post_id' => 4, 'topic_delete_reason' => 'approved'),
+ ),
+ ),
+ array(
+ ITEM_APPROVED, 2, 1,
+ 2, time(), 'approved-forced', true,
+ array(
+ array('post_id' => 4, 'post_visibility' => 1, 'post_delete_reason' => ''),
+ array('post_id' => 5, 'post_visibility' => 1, 'post_delete_reason' => ''),
+ array('post_id' => 6, 'post_visibility' => 1, 'post_delete_reason' => ''),
+ ),
+ array(
+ array('topic_visibility' => 1, 'topic_first_post_id' => 4, 'topic_last_post_id' => 6, 'topic_delete_reason' => 'approved-forced'),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider set_topic_visibility_data
+ */
+ public function test_set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all, $expected_posts, $expected_topic)
+ {
+ global $cache, $db, $auth, $phpbb_root_path, $phpEx;
+
+ $cache = new phpbb_mock_cache;
+ $db = $this->new_dbal();
+ $auth = $this->getMock('phpbb_auth');
+ $user = $this->getMock('phpbb_user');
+ $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+
+ $content_visibility->set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all);
+
+ $result = $db->sql_query('SELECT post_id, post_visibility, post_delete_reason
+ FROM phpbb_posts
+ WHERE topic_id = ' . $topic_id . '
+ ORDER BY post_id ASC');
+
+ $this->assertEquals($expected_posts, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
+
+ $result = $db->sql_query('SELECT topic_visibility, topic_first_post_id, topic_last_post_id, topic_delete_reason
+ FROM phpbb_topics
+ WHERE topic_id = ' . $topic_id);
+
+ $this->assertEquals($expected_topic, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
+ }
+}
diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php
index c06bf7d548..dfc4f80469 100644
--- a/tests/controller/controller_test.php
+++ b/tests/controller/controller_test.php
@@ -59,7 +59,7 @@ class phpbb_controller_controller_test extends phpbb_test_case
}
if (!class_exists('phpbb_controller_foo'))
{
- include(__DIR__.'/includes/controller/foo.php');
+ include(__DIR__.'/phpbb/controller/foo.php');
}
$resolver = new phpbb_controller_resolver(new phpbb_user, $container);
diff --git a/tests/controller/includes/controller/foo.php b/tests/controller/phpbb/controller/foo.php
index 04576e16c4..04576e16c4 100644
--- a/tests/controller/includes/controller/foo.php
+++ b/tests/controller/phpbb/controller/foo.php
diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php
index c28925272e..2d97672878 100644
--- a/tests/datetime/from_format_test.php
+++ b/tests/datetime/from_format_test.php
@@ -7,9 +7,6 @@
*
*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/session.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/user.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/datetime.php';
require_once dirname(__FILE__) . '/../mock/lang.php';
class phpbb_datetime_from_format_test extends phpbb_test_case
diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php
index e87fc1c6bd..077bfad933 100644
--- a/tests/dbal/auto_increment_test.php
+++ b/tests/dbal/auto_increment_test.php
@@ -8,7 +8,6 @@
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
class phpbb_dbal_auto_increment_test extends phpbb_database_test_case
{
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index c20e46011f..7bdbc696e7 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -8,7 +8,6 @@
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
class phpbb_dbal_db_tools_test extends phpbb_database_test_case
{
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php
index 1e40c9c6d6..9e55e4dd35 100644
--- a/tests/dbal/migrator_test.php
+++ b/tests/dbal/migrator_test.php
@@ -8,10 +8,6 @@
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/migrator.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/migration.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
-
require_once dirname(__FILE__) . '/migration/dummy.php';
require_once dirname(__FILE__) . '/migration/unfulfillable.php';
require_once dirname(__FILE__) . '/migration/if.php';
diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php
index 7d582f230b..b82d1ef48d 100644
--- a/tests/dbal/migrator_tool_config_test.php
+++ b/tests/dbal/migrator_tool_config_test.php
@@ -7,9 +7,6 @@
*
*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/config.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php';
-
class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
{
public function setup()
diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php
index 3303086b26..828fb76c65 100644
--- a/tests/dbal/migrator_tool_module_test.php
+++ b/tests/dbal/migrator_tool_module_test.php
@@ -8,8 +8,6 @@
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/module.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php';
class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
{
diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php
index 438ab2b28e..79d9db66da 100644
--- a/tests/dbal/migrator_tool_permission_test.php
+++ b/tests/dbal/migrator_tool_permission_test.php
@@ -8,8 +8,6 @@
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/permission.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php';
class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case
{
diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php
index d67dea3719..fceb8aa3d8 100644
--- a/tests/error_collector_test.php
+++ b/tests/error_collector_test.php
@@ -8,7 +8,6 @@
*/
require_once dirname(__FILE__) . '/../phpBB/includes/functions.php';
-require_once dirname(__FILE__) . '/../phpBB/includes/error_collector.php';
class phpbb_error_collector_test extends phpbb_test_case
{
diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php
index 6f3cebbd7c..3bf2c42573 100644
--- a/tests/extension/finder_test.php
+++ b/tests/extension/finder_test.php
@@ -36,7 +36,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_suffix_get_classes()
{
$classes = $this->finder
- ->core_path('includes/default/')
+ ->core_path('phpbb/default/')
->extension_suffix('_class')
->get_classes();
@@ -81,7 +81,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_prefix_get_classes()
{
$classes = $this->finder
- ->core_path('includes/default/')
+ ->core_path('phpbb/default/')
->extension_prefix('hidden_')
->get_classes();
@@ -98,7 +98,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_directory_get_classes()
{
$classes = $this->finder
- ->core_path('includes/default/')
+ ->core_path('phpbb/default/')
->extension_directory('type')
->get_classes();
@@ -209,7 +209,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_cached_get_files()
{
$query = array(
- 'core_path' => 'includes/foo',
+ 'core_path' => 'phpbb/foo',
'core_suffix' => false,
'core_prefix' => false,
'core_directory' => 'bar',
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
index bd88f396d9..e5bd29092e 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -7,8 +7,6 @@
*
*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
-
class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
{
protected $class_loader;
diff --git a/tests/extension/includes/default/implementation.php b/tests/extension/phpbb/default/implementation.php
index 91d5f8aa2f..91d5f8aa2f 100644
--- a/tests/extension/includes/default/implementation.php
+++ b/tests/extension/phpbb/default/implementation.php
diff --git a/tests/functional/auth_test.php b/tests/functional/auth_test.php
index ff4d3ced5c..cfd85571b7 100644
--- a/tests/functional/auth_test.php
+++ b/tests/functional/auth_test.php
@@ -39,7 +39,6 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case
// logout
$crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout');
- $this->assertContains($this->lang('LOGOUT_REDIRECT'), $crawler->filter('#message')->text());
// look for a register link, which should be visible only when logged out
$crawler = self::request('GET', 'index.php');
diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php
new file mode 100644
index 0000000000..9fdc29cc76
--- /dev/null
+++ b/tests/functional/avatar_acp_groups_test.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/common_avatar_test.php';
+
+/**
+ * @group functional
+ */
+class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_avatar_test
+{
+ public function get_url()
+ {
+ return 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5';
+ }
+
+ public function avatar_acp_groups_data()
+ {
+ return array(
+ // Correct Gravatar
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_gravatar_email' => 'test@example.com',
+ 'avatar_gravatar_width' => 80,
+ 'avatar_gravatar_height' => 80,
+ ),
+ ),
+ // Gravatar with incorrect size
+ array(
+ 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_gravatar_email' => 'test@example.com',
+ 'avatar_gravatar_width' => 120,
+ 'avatar_gravatar_height' => 120,
+ ),
+ ),
+ // Delete avatar image to reset group settings
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_delete' => array('tick', ''),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider avatar_acp_groups_data
+ */
+ public function test_avatar_acp_groups($expected, $avatar_type, $data)
+ {
+ $this->assert_avatar_submit($expected, $avatar_type, $data);
+ }
+}
diff --git a/tests/functional/avatar_acp_users_test.php b/tests/functional/avatar_acp_users_test.php
new file mode 100644
index 0000000000..0afd05e530
--- /dev/null
+++ b/tests/functional/avatar_acp_users_test.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/common_avatar_test.php';
+
+/**
+ * @group functional
+ */
+class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_avatar_test
+{
+ public function get_url()
+ {
+ return 'adm/index.php?i=acp_users&u=2&mode=avatar';
+ }
+
+ public function avatar_acp_users_data()
+ {
+ return array(
+ // Gravatar with incorrect email
+ array(
+ 'EMAIL_INVALID_EMAIL',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_gravatar_email' => 'test.example.com',
+ 'avatar_gravatar_width' => 80,
+ 'avatar_gravatar_height' => 80,
+ ),
+ ),
+ // Remote avatar with correct link
+ array(
+ 'USER_AVATAR_UPDATED',
+ 'avatar_driver_upload',
+ array(
+ 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ ),
+ ),
+ // Reset avatar settings
+ array(
+ 'USER_AVATAR_UPDATED',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_delete' => array('tick', ''),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider avatar_acp_users_data
+ */
+ public function test_avatar_acp_users($expected, $avatar_type, $data)
+ {
+ $this->assert_avatar_submit($expected, $avatar_type, $data);
+ }
+}
diff --git a/tests/functional/avatar_ucp_groups_test.php b/tests/functional/avatar_ucp_groups_test.php
new file mode 100644
index 0000000000..233b7d36e1
--- /dev/null
+++ b/tests/functional/avatar_ucp_groups_test.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/common_avatar_test.php';
+
+/**
+ * @group functional
+ */
+class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_avatar_test
+{
+ public function get_url()
+ {
+ return 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5';
+ }
+
+ public function avatar_ucp_groups_data()
+ {
+ return array(
+ // Incorrect URL
+ array(
+ 'AVATAR_URL_INVALID',
+ 'avatar_driver_upload',
+ array(
+ 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80',
+ ),
+ ),
+ /*
+ // Does not work due to DomCrawler issue
+ // Valid file upload
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_upload',
+ array(
+ 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'),
+ ),
+ ),
+ */
+ // Correct remote avatar
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_remote',
+ array(
+ 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ 'avatar_remote_width' => 80,
+ 'avatar_remote_height' => 80,
+ ),
+ ),
+ array(
+ 'GROUP_UPDATED',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_delete' => array('tick', ''),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider avatar_ucp_groups_data
+ */
+ public function test_avatar_ucp_groups($expected, $avatar_type, $data)
+ {
+ $this->assert_avatar_submit($expected, $avatar_type, $data);
+ }
+}
diff --git a/tests/functional/avatar_ucp_users_test.php b/tests/functional/avatar_ucp_users_test.php
new file mode 100644
index 0000000000..f828559e0d
--- /dev/null
+++ b/tests/functional/avatar_ucp_users_test.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/common_avatar_test.php';
+
+/**
+ * @group functional
+ */
+class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_avatar_test
+{
+ public function get_url()
+ {
+ return 'ucp.php?i=ucp_profile&mode=avatar';
+ }
+
+ public function avatar_ucp_groups_data()
+ {
+ return array(
+ // Gravatar with correct settings
+ array(
+ 'PROFILE_UPDATED',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_gravatar_email' => 'test@example.com',
+ 'avatar_gravatar_width' => 80,
+ 'avatar_gravatar_height' => 80,
+ ),
+ ),
+ // Wrong driver selected
+ array(
+ 'NO_AVATAR_SELECTED',
+ 'avatar_driver_upload',
+ array(
+ 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ 'avatar_remote_width' => 80,
+ 'avatar_remote_height' => 80,
+ ),
+ ),
+ array(
+ 'PROFILE_UPDATED',
+ 'avatar_driver_gravatar',
+ array(
+ 'avatar_delete' => array('tick', ''),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider avatar_ucp_groups_data
+ */
+ public function test_avatar_ucp_groups($expected, $avatar_type, $data)
+ {
+ $this->assert_avatar_submit($expected, $avatar_type, $data);
+ }
+
+ public function test_display_upload_avatar()
+ {
+ $this->assert_avatar_submit('PROFILE_UPDATED',
+ 'avatar_driver_upload',
+ array(
+ 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
+ )
+ );
+
+ $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid);
+ $avatar_link = $crawler->filter('img')->attr('src');
+ $crawler = self::request('GET', $avatar_link . '&sid=' . $this->sid, array(), false);
+ $content = self::$client->getResponse()->getContent();
+ self::assertEquals(false, stripos(trim($content), 'debug'), 'Output contains debug message');
+ }
+}
diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php
index 18a2ad9464..c3be301762 100644
--- a/tests/functional/browse_test.php
+++ b/tests/functional/browse_test.php
@@ -29,4 +29,11 @@ class phpbb_functional_browse_test extends phpbb_functional_test_case
$crawler = self::request('GET', 'viewtopic.php?t=1');
$this->assertGreaterThan(0, $crawler->filter('.postbody')->count());
}
+
+ public function test_feed()
+ {
+ $crawler = self::request('GET', 'feed.php', array(), false);
+ self::assert_response_xml();
+ $this->assertGreaterThan(0, $crawler->filter('entry')->count());
+ }
}
diff --git a/tests/functional/common_avatar_test.php b/tests/functional/common_avatar_test.php
new file mode 100644
index 0000000000..c0f21d07c2
--- /dev/null
+++ b/tests/functional/common_avatar_test.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+/**
+ * @group functional
+ */
+abstract class phpbb_functional_common_avatar_test extends phpbb_functional_test_case
+{
+ private $path;
+ private $form_content;
+
+ abstract function get_url();
+
+ public function setUp()
+ {
+ parent::setUp();
+ $this->path = __DIR__ . '/fixtures/files/';
+ $this->login();
+ $this->admin_login();
+ $this->add_lang(array('acp/board', 'ucp', 'acp/users', 'acp/groups'));
+ $this->set_acp_settings();
+ }
+
+ private function set_acp_settings()
+ {
+ $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid);
+ // Check the default entries we should have
+ $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text());
+ $this->assertContainsLang('ALLOW_REMOTE', $crawler->text());
+ $this->assertContainsLang('ALLOW_AVATARS', $crawler->text());
+ $this->assertContainsLang('ALLOW_LOCAL', $crawler->text());
+
+ // Now start setting the needed settings
+ $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
+ $form['config[allow_avatar_local]']->select(1);
+ $form['config[allow_avatar_gravatar]']->select(1);
+ $form['config[allow_avatar_remote]']->select(1);
+ $form['config[allow_avatar_remote_upload]']->select(1);
+ $crawler = self::submit($form);
+ $this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
+ }
+
+ public function assert_avatar_submit($expected, $type, $data, $button_text = 'SUBMIT')
+ {
+ $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid);
+
+ // Test if setting a gravatar avatar properly works
+ $form = $crawler->selectButton($this->lang($button_text))->form();
+ $form['avatar_driver']->select($type);
+
+ foreach ($data as $key => $value)
+ {
+ if (is_array($value))
+ {
+ $form[$key]->$value[0]($value[1]);
+ }
+ else
+ {
+ $form[$key]->setValue($value);
+ }
+ }
+
+ $crawler = self::submit($form);
+
+ try
+ {
+ $this->assertContainsLang($expected, $crawler->text());
+ }
+ catch (Exception $e)
+ {
+ $this->assertContains($expected, $crawler->text());
+ }
+ }
+}
diff --git a/tests/functional/common_groups_test.php b/tests/functional/common_groups_test.php
index 8c014aebed..6c6572af62 100644
--- a/tests/functional/common_groups_test.php
+++ b/tests/functional/common_groups_test.php
@@ -36,6 +36,26 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test
$this->add_lang(array('ucp', 'acp/groups'));
}
+ // Enable all avatars in the ACP
+ protected function enable_all_avatars()
+ {
+ $this->add_lang('acp/board');
+
+ $crawler = self::request('GET', 'adm/index.php?i=board&mode=avatar&sid=' . $this->sid);
+ // Check the default entries we should have
+ $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text());
+ $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text());
+ $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text());
+
+ // Now start setting the needed settings
+ $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
+ $form['config[allow_avatar_local]']->select(1);
+ $form['config[allow_avatar_remote]']->select(1);
+ $form['config[allow_avatar_remote_upload]']->select(1);
+ $crawler = self::submit($form);
+ $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text());
+ }
+
public function groups_manage_test_data()
{
return array(
@@ -60,4 +80,34 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test
$crawler = self::submit($form);
$this->assertContains($this->lang($expected), $crawler->text());
}
+
+ public function group_avatar_min_max_data()
+ {
+ return array(
+ array('avatar_driver_upload', 'avatar_upload_url', 'foo', 'AVATAR_URL_INVALID'),
+ array('avatar_driver_upload', 'avatar_upload_url', 'foobar', 'AVATAR_URL_INVALID'),
+ array('avatar_driver_upload', 'avatar_upload_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'),
+ array('avatar_driver_remote', 'avatar_remote_url', 'foo', 'AVATAR_URL_INVALID'),
+ array('avatar_driver_remote', 'avatar_remote_url', 'foobar', 'AVATAR_URL_INVALID'),
+ array('avatar_driver_remote', 'avatar_remote_url', 'http://www.phpbb.com/' . str_repeat('f', 240) . '.png', 'TOO_LONG'),
+ );
+ }
+
+ /**
+ * @dataProvider group_avatar_min_max_data
+ */
+ public function test_group_avatar_min_max($avatar_type, $form_name, $input, $expected)
+ {
+ $this->login();
+ $this->admin_login();
+ $this->add_lang(array('ucp', 'acp/groups'));
+ $this->enable_all_avatars();
+
+ $crawler = self::request('GET', $this->get_url() . '&g=5&sid=' . $this->sid);
+ $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
+ $form['avatar_driver']->setValue($avatar_type);
+ $form[$form_name]->setValue($input);
+ $crawler = self::submit($form);
+ $this->assertContains($this->lang($expected), $crawler->text());
+ }
}
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index 9ddf1e3e5c..7d29f0000c 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -6,7 +6,6 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
/**
* @group functional
diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php
index c573ea5410..c31a892ce9 100644
--- a/tests/functional/extension_module_test.php
+++ b/tests/functional/extension_module_test.php
@@ -6,8 +6,6 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
-
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php';
/**
diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php
index 6c1720735c..19adb89819 100644
--- a/tests/functional/extension_permission_lang_test.php
+++ b/tests/functional/extension_permission_lang_test.php
@@ -18,6 +18,7 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t
static protected $fixtures = array(
'foo/bar/language/en/',
+ 'foo/bar/event/',
);
static public function setUpBeforeClass()
@@ -75,6 +76,6 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t
$this->assertContains('Can attach files', $crawler->filter('body')->text());
// language from ext/foo/bar/language/en/permissions_foo.php
- $this->assertContains('Can view foo', $crawler->filter('body')->text());
+ $this->assertContains('Can view foobar', $crawler->filter('body')->text());
}
}
diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php b/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php
new file mode 100644
index 0000000000..6986755f71
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/bar/event/permission_listener.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+*
+* @package testing
+* @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;
+}
+
+/**
+* Event listener
+*/
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+
+class phpbb_ext_foo_bar_event_permission_listener implements EventSubscriberInterface
+{
+ static public function getSubscribedEvents()
+ {
+ return array(
+ 'core.permissions' => 'add_permissions',
+ );
+ }
+
+ public function add_permissions($event)
+ {
+ $permissions = $event['permissions'];
+ $permissions['u_foo'] = array('lang' => 'ACL_U_FOOBAR', 'cat' => 'post');
+ $event['permissions'] = $permissions;
+ }
+}
diff --git a/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php b/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php
index cd4b9a32d1..64b497c394 100644
--- a/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php
+++ b/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php
@@ -1,6 +1,5 @@
<?php
-// Admin Permissions
$lang = array_merge($lang, array(
- 'acl_u_foo' => array('lang' => 'Can view foo', 'cat' => 'misc'),
+ 'ACL_U_FOOBAR' => 'Can view foobar with permission foo',
));
diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php
index c55e7373ea..651c99a99d 100644
--- a/tests/functional/metadata_manager_test.php
+++ b/tests/functional/metadata_manager_test.php
@@ -7,8 +7,6 @@
*
*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php';
-
/**
* @group functional
*/
diff --git a/tests/functional/report_post_captcha.php b/tests/functional/report_post_captcha_test.php
index af713775c5..8283465041 100644
--- a/tests/functional/report_post_captcha.php
+++ b/tests/functional/report_post_captcha_test.php
@@ -12,13 +12,6 @@
*/
class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_case
{
- public function test_user_report_post()
- {
- $this->login();
- $crawler = self::request('GET', 'report.php?f=2&p=1');
- $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text());
- }
-
public function test_guest_report_post()
{
$crawler = self::request('GET', 'report.php?f=2&p=1');
@@ -31,6 +24,18 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca
$this->set_reporting_guest(-1);
}
+ public function test_user_report_post()
+ {
+ $this->login();
+ $crawler = self::request('GET', 'report.php?f=2&p=1');
+ $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text());
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
+ $crawler = self::submit($form);
+ $this->assertContains($this->lang('POST_REPORTED_SUCCESS'), $crawler->text());
+ }
+
protected function set_reporting_guest($report_post_allowed)
{
$this->login();
diff --git a/tests/functional/softdelete_test.php b/tests/functional/softdelete_test.php
new file mode 100644
index 0000000000..bd4d34cf99
--- /dev/null
+++ b/tests/functional/softdelete_test.php
@@ -0,0 +1,761 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_softdelete_test extends phpbb_functional_test_case
+{
+ protected $data = array();
+
+ public function test_setup_forums()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}");
+ $form = $crawler->selectButton('addforum')->form(array(
+ 'forum_name' => 'Soft Delete #1',
+ ));
+ $crawler = self::submit($form);
+ $form = $crawler->selectButton('update')->form(array(
+ 'forum_perm_from' => 2,
+ ));
+ $crawler = self::submit($form);
+
+ $crawler = self::request('GET', "adm/index.php?i=acp_forums&mode=manage&sid={$this->sid}");
+ $form = $crawler->selectButton('addforum')->form(array(
+ 'forum_name' => 'Soft Delete #2',
+ ));
+ $crawler = self::submit($form);
+ $form = $crawler->selectButton('update')->form(array(
+ 'forum_perm_from' => 2,
+ ));
+ $crawler = self::submit($form);
+ }
+
+ public function test_create_post()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'initial comparison');
+
+ // Test creating topic
+ $post = $this->create_topic($this->data['forums']['Soft Delete #1'], 'Soft Delete Topic #1', 'This is a test topic posted by the testing framework.');
+ $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
+
+ $this->assertContains('Soft Delete Topic #1', $crawler->filter('html')->text());
+ $this->data['topics']['Soft Delete Topic #1'] = (int) $post['topic_id'];
+ $this->data['posts']['Soft Delete Topic #1'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after creating topic #1');
+
+ // Test creating a reply
+ $post2 = $this->create_post($this->data['forums']['Soft Delete #1'], $post['topic_id'], 'Re: Soft Delete Topic #1-#2', 'This is a test post posted by the testing framework.');
+ $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}");
+
+ $this->assertContains('Re: Soft Delete Topic #1-#2', $crawler->filter('html')->text());
+ $this->data['posts']['Re: Soft Delete Topic #1-#2'] = (int) $this->get_parameter_from_link($crawler->filter('.post')->eq(1)->selectLink($this->lang('POST', '', ''))->link()->getUri(), 'p');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 2,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'],
+ ), 'after replying');
+ }
+
+ public function test_softdelete_post()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 2,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Re: Soft Delete Topic #1-#2'],
+ ), 'before softdelete');
+
+ $this->add_lang('posting');
+ $crawler = self::request('GET', "posting.php?mode=delete&f={$this->data['forums']['Soft Delete #1']}&p={$this->data['posts']['Re: Soft Delete Topic #1-#2']}&sid={$this->sid}");
+ $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
+
+ $form = $crawler->selectButton('Yes')->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang('POST_DELETED', $crawler->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after softdelete');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+ $this->assertContains($this->lang('POST_DISPLAY', '', ''), $crawler->text());
+ }
+
+ public function test_move_softdeleted_post()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'before moving #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'before moving #2');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+
+ $form = $crawler->selectButton('Go')->eq(2)->form();
+ $form['action']->select('move');
+ $crawler = self::submit($form);
+ $this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton('Yes')->form();
+ $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']);
+ $crawler = self::submit($form);
+ $this->assertContainsLang('TOPIC_MOVED_SUCCESS', $crawler->text());
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+ $this->assertContains('Soft Delete #2', $crawler->filter('.navlinks')->text());
+ $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'after moving #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after moving #2');
+ }
+
+ public function test_softdelete_topic()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'before softdeleting #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'before softdeleting #2');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+
+ $this->add_lang('posting');
+ $form = $crawler->selectButton('Go')->eq(2)->form();
+ $form['action']->select('delete_topic');
+ $crawler = self::submit($form);
+ $this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton('Yes')->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang('TOPIC_DELETED_SUCCESS', $crawler->text());
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+ $this->assertContains('Soft Delete #2', $crawler->filter('.navlinks')->text());
+ $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'after moving #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 2,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 1,
+ 'forum_last_post_id' => 0,
+ ), 'after moving #2');
+ }
+
+ public function test_move_softdeleted_topic()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'before moving #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 2,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 1,
+ 'forum_last_post_id' => 0,
+ ), 'before moving #2');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+
+ $form = $crawler->selectButton('Go')->eq(2)->form();
+ $form['action']->select('move');
+ $crawler = self::submit($form);
+ $this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton('Yes')->form();
+ $form['to_forum_id']->select($this->data['forums']['Soft Delete #1']);
+ $crawler = self::submit($form);
+ $this->assertContainsLang('TOPIC_MOVED_SUCCESS', $crawler->text());
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+ $this->assertContains('Soft Delete #1', $crawler->filter('.navlinks')->text());
+ $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 2,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 1,
+ 'forum_last_post_id' => 0,
+ ), 'after moving #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'after moving #2');
+ }
+
+ public function test_restore_post()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 2,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 1,
+ 'forum_last_post_id' => 0,
+ ), 'before restoring #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'before restoring #2');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton($this->lang('RESTORE'))->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang('RESTORE_POST', $crawler->text());
+
+ $form = $crawler->selectButton('Yes')->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang('POST_RESTORED_SUCCESS', $crawler->text());
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+ $this->assertContains('Soft Delete #1', $crawler->filter('.navlinks')->text());
+ $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after restoring #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'after restoring #2');
+ }
+
+ public function test_split_topic()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'before splitting #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'before splitting #2');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton('Go')->eq(2)->form();
+ $form['action']->select('split');
+ $crawler = self::submit($form);
+ $this->assertContainsLang('SPLIT_TOPIC_EXPLAIN', $crawler->text());
+
+ $form = $crawler->selectButton('Submit')->form(array(
+ 'subject' => 'Soft Delete Topic #2',
+ ));
+ $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']);
+ $form['post_id_list'][1]->tick();
+ $crawler = self::submit($form);
+
+ $form = $crawler->selectButton('Yes')->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang('TOPIC_SPLIT_SUCCESS', $crawler->text());
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+ $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
+ $this->assertNotContains('Re: Soft Delete Topic #1-#2', $crawler->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after restoring #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 1,
+ 'forum_last_post_id' => 0,
+ ), 'after restoring #2');
+ }
+
+ public function test_move_topic_back()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ 'Soft Delete Topic #2',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2']}&sid={$this->sid}");
+
+ $form = $crawler->selectButton('Go')->eq(1)->form();
+ $form['action']->select('move');
+ $crawler = self::submit($form);
+
+ $form = $crawler->selectButton('Yes')->form();
+ $form['to_forum_id']->select($this->data['forums']['Soft Delete #1']);
+ $crawler = self::submit($form);
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 1,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after moving back');
+ }
+
+ public function test_merge_topics()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ 'Soft Delete Topic #2',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 1,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'before merging #1');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2']}&sid={$this->sid}");
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton('Go')->eq(1)->form();
+ $form['action']->select('merge_topic');
+ $crawler = self::submit($form);
+ $this->assertContainsLang('SELECT_MERGE', $crawler->text());
+
+ $crawler = self::request('GET', "mcp.php?f={$this->data['forums']['Soft Delete #1']}&t={$this->data['topics']['Soft Delete Topic #2']}&i=main&mode=forum_view&action=merge_topic&to_topic_id={$this->data['topics']['Soft Delete Topic #1']}");
+ $this->assertContainsLang('MERGE_TOPICS_CONFIRM', $crawler->text());
+
+ $form = $crawler->selectButton('Yes')->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang('POSTS_MERGED_SUCCESS', $crawler->text());
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+ $this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
+ $this->assertContainsLang('POST_DELETED', $crawler->filter('body')->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after merging #1');
+ }
+
+ public function test_fork_topic()
+ {
+ $this->login();
+ $this->load_ids(array(
+ 'forums' => array(
+ 'Soft Delete #1',
+ 'Soft Delete #2',
+ ),
+ 'topics' => array(
+ 'Soft Delete Topic #1',
+ ),
+ 'posts' => array(
+ 'Soft Delete Topic #1',
+ 'Re: Soft Delete Topic #1-#2',
+ ),
+ ));
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'before forking #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 0,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 0,
+ 'forum_topics_approved' => 0,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => 0,
+ ), 'before forking #2');
+
+ $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
+
+ $this->add_lang('mcp');
+ $form = $crawler->selectButton('Go')->eq(2)->form();
+ $form['action']->select('fork');
+ $crawler = self::submit($form);
+ $this->assertContainsLang('FORK_TOPIC', $crawler->text());
+
+ $form = $crawler->selectButton('Yes')->form();
+ $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']);
+ $crawler = self::submit($form);
+ $this->assertContainsLang('TOPIC_FORKED_SUCCESS', $crawler->text());
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
+ ), 'after forking #1');
+
+ $this->assert_forum_details($this->data['forums']['Soft Delete #2'], array(
+ 'forum_posts_approved' => 1,
+ 'forum_posts_unapproved' => 0,
+ 'forum_posts_softdeleted' => 1,
+ 'forum_topics_approved' => 1,
+ 'forum_topics_unapproved' => 0,
+ 'forum_topics_softdeleted' => 0,
+ 'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'] + 2,
+ ), 'after forking #2');
+ }
+
+ public function assert_forum_details($forum_id, $details, $additional_error_message = '')
+ {
+ $this->db = $this->get_db();
+
+ $sql = 'SELECT ' . implode(', ', array_keys($details)) . '
+ FROM phpbb_forums
+ WHERE forum_id = ' . (int) $forum_id;
+ $result = $this->db->sql_query($sql);
+ $data = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ $this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}");
+ }
+
+ public function load_ids($data)
+ {
+ $this->db = $this->get_db();
+
+ if (!empty($data['forums']))
+ {
+ $sql = 'SELECT *
+ FROM phpbb_forums
+ WHERE ' . $this->db->sql_in_set('forum_name', $data['forums']);
+ $result = $this->db->sql_query($sql);
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ if (in_array($row['forum_name'], $data['forums']))
+ {
+ $this->data['forums'][$row['forum_name']] = (int) $row['forum_id'];
+ }
+ }
+ $this->db->sql_freeresult($result);
+ }
+
+ if (!empty($data['topics']))
+ {
+ $sql = 'SELECT *
+ FROM phpbb_topics
+ WHERE ' . $this->db->sql_in_set('topic_title', $data['topics']);
+ $result = $this->db->sql_query($sql);
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ if (in_array($row['topic_title'], $data['topics']))
+ {
+ $this->data['topics'][$row['topic_title']] = (int) $row['topic_id'];
+ }
+ }
+ $this->db->sql_freeresult($result);
+ }
+
+ if (!empty($data['posts']))
+ {
+ $sql = 'SELECT *
+ FROM phpbb_posts
+ WHERE ' . $this->db->sql_in_set('post_subject', $data['posts']);
+ $result = $this->db->sql_query($sql);
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ if (in_array($row['post_subject'], $data['posts']))
+ {
+ $this->data['posts'][$row['post_subject']] = (int) $row['post_id'];
+ }
+ }
+ $this->db->sql_freeresult($result);
+ }
+ }
+}
diff --git a/tests/functional/ucp_groups_test.php b/tests/functional/ucp_groups_test.php
index 1f9749ec15..f48c793ea1 100644
--- a/tests/functional/ucp_groups_test.php
+++ b/tests/functional/ucp_groups_test.php
@@ -50,53 +50,4 @@ class phpbb_functional_ucp_groups_test extends phpbb_functional_common_groups_te
$this->assertContains($this->lang('GROUP_UPDATED'), $crawler->text());
$this->assertEquals($teampage_settings, $this->get_teampage_settings());
}
-
- // Enable all avatars in the ACP
- private function enable_all_avatars()
- {
- $this->add_lang('acp/board');
-
- $crawler = self::request('GET', 'adm/index.php?i=board&mode=avatar&sid=' . $this->sid);
- // Check the default entries we should have
- $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text());
- $this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text());
- $this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text());
-
- // Now start setting the needed settings
- $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
- $form['config[allow_avatar_local]']->select(1);
- $form['config[allow_avatar_remote]']->select(1);
- $form['config[allow_avatar_remote_upload]']->select(1);
- $crawler = self::submit($form);
- $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->text());
- }
-
- public function group_avatar_min_max_data()
- {
- return array(
- array('uploadurl', 'foo', 'TOO_SHORT'),
- array('uploadurl', 'foobar', 'AVATAR_URL_INVALID'),
- array('uploadurl', str_repeat('f', 256), 'TOO_LONG'),
- array('remotelink', 'foo', 'TOO_SHORT'),
- array('remotelink', 'foobar', 'AVATAR_URL_INVALID'),
- array('remotelink', str_repeat('f', 256), 'TOO_LONG'),
- );
- }
-
- /**
- * @dataProvider group_avatar_min_max_data
- */
- public function test_group_avatar_min_max($form_name, $input, $expected)
- {
- $this->login();
- $this->admin_login();
- $this->add_lang(array('ucp', 'acp/groups'));
- $this->enable_all_avatars();
-
- $crawler = self::request('GET', $this->get_url() . '&g=5&sid=' . $this->sid);
- $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
- $form[$form_name]->setValue($input);
- $crawler = self::submit($form);
- $this->assertContains($this->lang($expected), $crawler->text());
- }
}
diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php
index 1ab9488568..6827aaa1b6 100644
--- a/tests/log/function_view_log_test.php
+++ b/tests/log/function_view_log_test.php
@@ -11,7 +11,6 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/session.php';
require_once dirname(__FILE__) . '/../mock/user.php';
require_once dirname(__FILE__) . '/../mock/cache.php';
diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php
new file mode 100644
index 0000000000..9d002334d6
--- /dev/null
+++ b/tests/mock/auth_provider.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+/**
+ * Mock auth provider class with basic functions to help test sessions.
+ */
+class phpbb_mock_auth_provider implements phpbb_auth_provider_interface
+{
+ function init()
+ {
+ return null;
+ }
+
+ function login($username, $password)
+ {
+ return array(
+ 'status' => "",
+ 'error_msg' => "",
+ 'user_row' => "",
+ );
+ }
+
+ function autologin()
+ {
+ return array();
+ }
+
+ function acp()
+ {
+ return array();
+ }
+
+ function logout($data, $new_session)
+ {
+ return null;
+ }
+
+ function validate_session($user)
+ {
+ return null;
+ }
+
+ public function get_acp_template($new_config)
+ {
+ return null;
+ }
+}
diff --git a/tests/mock/search.php b/tests/mock/search.php
new file mode 100644
index 0000000000..6739719216
--- /dev/null
+++ b/tests/mock/search.php
@@ -0,0 +1,23 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+*/
+class phpbb_mock_search
+{
+
+ public function __construct($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user)
+ {
+ }
+
+ public function index_remove($post_ids, $poster_ids, $forum_ids)
+ {
+ }
+}
+
diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php
index 56ff8c8b32..283f9af192 100644
--- a/tests/mock/session_testable.php
+++ b/tests/mock/session_testable.php
@@ -58,5 +58,9 @@ class phpbb_mock_session_testable extends phpbb_session
}
}
}
+
+ public function setup()
+ {
+ }
}
diff --git a/tests/mock/sql_insert_buffer.php b/tests/mock/sql_insert_buffer.php
new file mode 100644
index 0000000000..ba09aa8d7f
--- /dev/null
+++ b/tests/mock/sql_insert_buffer.php
@@ -0,0 +1,21 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_mock_sql_insert_buffer extends phpbb_db_sql_insert_buffer
+{
+ public function flush()
+ {
+ return (sizeof($this->buffer)) ? true : false;
+ }
+
+ public function get_buffer()
+ {
+ return $this->buffer;
+ }
+}
diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php
new file mode 100644
index 0000000000..c038020385
--- /dev/null
+++ b/tests/notification/convert_test.php
@@ -0,0 +1,108 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+require_once dirname(__FILE__) . '/../mock/sql_insert_buffer.php';
+
+class phpbb_notification_convert_test extends phpbb_database_test_case
+{
+ protected $notifications, $db, $container, $user, $config, $auth, $cache;
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/convert.xml');
+ }
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ global $phpbb_root_path, $phpEx;
+
+ $this->db = $this->new_dbal();
+
+ $this->migration = new phpbb_db_migration_data_310_notification_options_reconvert(
+ new phpbb_config(array()),
+ $this->db,
+ new phpbb_db_tools($this->db),
+ $phpbb_root_path,
+ $phpEx,
+ 'phpbb_'
+ );
+ }
+
+ public function test_convert()
+ {
+ $buffer = new phpbb_mock_sql_insert_buffer($this->db, 'phpbb_user_notifications');
+ $this->migration->perform_conversion($buffer, 'phpbb_user_notifications');
+
+ $expected = array_merge(
+ $this->create_expected('post', 1, 'email'),
+ $this->create_expected('topic', 1, 'email'),
+
+ $this->create_expected('post', 2, 'email'),
+ $this->create_expected('topic', 2, 'email'),
+ $this->create_expected('pm', 2, 'email'),
+
+ $this->create_expected('post', 3, 'jabber'),
+ $this->create_expected('topic', 3, 'jabber'),
+
+ $this->create_expected('post', 4, 'jabber'),
+ $this->create_expected('topic', 4, 'jabber'),
+ $this->create_expected('pm', 4, 'jabber'),
+
+ $this->create_expected('post', 5, 'both'),
+ $this->create_expected('topic', 5, 'both'),
+
+ $this->create_expected('post', 6, 'both'),
+ $this->create_expected('topic', 6, 'both'),
+ $this->create_expected('pm', 6, 'both')
+ );
+
+ $this->assertEquals($expected, $buffer->get_buffer());
+ }
+
+ protected function create_expected($type, $user_id, $method = '')
+ {
+ $return = array();
+
+ if ($method !== '')
+ {
+ $return[] = array(
+ 'item_type' => $type,
+ 'item_id' => 0,
+ 'user_id' => $user_id,
+ 'method' => '',
+ 'notify' => 1,
+ );
+ }
+
+ if ($method === 'email' || $method === 'both')
+ {
+ $return[] = array(
+ 'item_type' => $type,
+ 'item_id' => 0,
+ 'user_id' => $user_id,
+ 'method' => 'email',
+ 'notify' => 1,
+ );
+ }
+
+ if ($method === 'jabber' || $method === 'both')
+ {
+ $return[] = array(
+ 'item_type' => $type,
+ 'item_id' => 0,
+ 'user_id' => $user_id,
+ 'method' => 'jabber',
+ 'notify' => 1,
+ );
+ }
+
+ return $return;
+ }
+}
diff --git a/tests/notification/fixtures/convert.xml b/tests/notification/fixtures/convert.xml
new file mode 100644
index 0000000000..3f0a065cc4
--- /dev/null
+++ b/tests/notification/fixtures/convert.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username</column>
+ <column>username_clean</column>
+ <column>user_notify_type</column>
+ <column>user_notify_pm</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>2</value>
+ <value>2</value>
+ <value>0</value>
+ <value>1</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>3</value>
+ <value>3</value>
+ <value>1</value>
+ <value>0</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>4</value>
+ <value>4</value>
+ <value>4</value>
+ <value>1</value>
+ <value>1</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>5</value>
+ <value>5</value>
+ <value>2</value>
+ <value>0</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>6</value>
+ <value>6</value>
+ <value>6</value>
+ <value>2</value>
+ <value>1</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php
index 59daf6c9cb..4e564ce23c 100644
--- a/tests/notification/submit_post_base.php
+++ b/tests/notification/submit_post_base.php
@@ -96,6 +96,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
// Container
$phpbb_container = new phpbb_mock_container_builder();
+ $phpbb_container->set('content.visibility', new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
$user_loader = new phpbb_user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php
new file mode 100644
index 0000000000..8d6c9a866d
--- /dev/null
+++ b/tests/session/check_ban_test.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+
+class phpbb_session_check_ban_test extends phpbb_session_test_case
+{
+ protected $user_id = 4;
+ protected $key_id = 4;
+ protected $session;
+ protected $backup_cache;
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_banlist.xml');
+ }
+
+ static function check_banned_data()
+ {
+ return array(
+ array('All false values, should not be banned',
+ false, false, false, false, /* should be banned? -> */ false),
+ array('Matching values in the database, should be banned',
+ 4, '127.0.0.1', 'bar@example.org', true, /* should be banned? -> */ true),
+ array('IP Banned, should be banned',
+ false, '127.1.1.1', false, false, /* should be banned? -> */ true),
+ );
+ }
+
+ public function setUp()
+ {
+ parent::setUp();
+ // Get session here so that config is mocked correctly
+ $this->session = $this->session_factory->get_session($this->db);
+ global $cache, $config, $phpbb_root_path, $phpEx;
+ $this->backup_cache = $cache;
+ // Change the global cache object for this test because
+ // the mock cache object does not hit the database as is needed
+ // for this test.
+ $cache = new phpbb_cache_service(
+ new phpbb_cache_driver_file(),
+ $config,
+ $this->db,
+ $phpbb_root_path,
+ $phpEx
+ );
+ }
+
+ public function tearDown()
+ {
+ parent::tearDown();
+ // Set cache back to what it was before the test changed it
+ global $cache;
+ $cache = $this->backup_cache;
+ }
+
+ /** @dataProvider check_banned_data */
+ public function test_check_is_banned($test_msg, $user_id, $user_ips, $user_email, $return, $should_be_banned)
+ {
+ try
+ {
+ $is_banned = $this->session->check_ban($user_id, $user_ips, $user_email, $return);
+ }
+ catch (PHPUnit_Framework_Error_Notice $e)
+ {
+ // User error was triggered, user must have been banned
+ $is_banned = true;
+ }
+
+ $this->assertEquals($should_be_banned, $is_banned, $test_msg);
+ }
+}
diff --git a/tests/session/check_isvalid_test.php b/tests/session/check_isvalid_test.php
new file mode 100644
index 0000000000..760e2a6f24
--- /dev/null
+++ b/tests/session/check_isvalid_test.php
@@ -0,0 +1,61 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+
+class phpbb_session_check_isvalid_test extends phpbb_session_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml');
+ }
+
+ protected function access_with($session_id, $user_id, $user_agent, $ip)
+ {
+ $this->session_factory->merge_test_data($session_id, $user_id, $user_agent, $ip);
+
+ $session = $this->session_factory->get_session($this->db);
+ $session->page = array('page' => 'page', 'forum' => 0);
+
+ $session->session_begin();
+ $this->session_factory->check($this);
+ return $session;
+ }
+
+ public function test_session_valid_session_exists()
+ {
+ $session = $this->access_with('bar_session000000000000000000000', '4', 'user agent', '127.0.0.1');
+ $session->check_cookies($this, array());
+
+ $this->check_sessions_equals(array(
+ array('session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1),
+ array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4),
+ ),
+ 'If a request comes with a valid session id with matching user agent and IP, no new session should be created.'
+ );
+ }
+
+ public function test_session_invalid_make_new_annon_session()
+ {
+ $session = $this->access_with('anon_session00000000000000000000', '4', 'user agent', '127.0.0.1');
+ $session->check_cookies($this, array(
+ 'u' => array('1', null),
+ 'k' => array(null, null),
+ 'sid' => array($session->session_id, null),
+ ));
+
+ $this->check_sessions_equals(array(
+ array('session_id' => $session->session_id, 'session_user_id' => 1), // use generated SID
+ array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4),
+ ),
+ 'If a request comes with a valid session id and IP but different user id and user agent,
+ a new anonymous session is created and the session matching the supplied session id is deleted.'
+ );
+ }
+}
diff --git a/tests/session/continue_test.php b/tests/session/continue_test.php
deleted file mode 100644
index e5a7f7a4a1..0000000000
--- a/tests/session/continue_test.php
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-require_once dirname(__FILE__) . '/testable_factory.php';
-
-class phpbb_session_continue_test extends phpbb_database_test_case
-{
- public function getDataSet()
- {
- return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml');
- }
-
- static public function session_begin_attempts()
- {
- // The session_id field is defined as CHAR(32) in the database schema.
- // Thus the data we put in session_id fields has to have a length of 32 characters on stricter DBMSes.
- // Thus we fill those strings up with zeroes until they have a string length of 32.
-
- return array(
- array(
- 'bar_session000000000000000000000', '4', 'user agent', '127.0.0.1',
- array(
- array('session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1),
- array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4),
- ),
- array(),
- 'If a request comes with a valid session id with matching user agent and IP, no new session should be created.',
- ),
- array(
- 'anon_session00000000000000000000', '4', 'user agent', '127.0.0.1',
- array(
- array('session_id' => '__new_session_id__', 'session_user_id' => 1), // use generated SID
- array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4),
- ),
- array(
- 'u' => array('1', null),
- 'k' => array(null, null),
- 'sid' => array('__new_session_id__', null),
- ),
- 'If a request comes with a valid session id and IP but different user id and user agent, a new anonymous session is created and the session matching the supplied session id is deleted.',
- ),
- );
- }
-
- /**
- * @dataProvider session_begin_attempts
- */
- public function test_session_begin_valid_session($session_id, $user_id, $user_agent, $ip, $expected_sessions, $expected_cookies, $message)
- {
- global $phpbb_container, $phpbb_root_path, $phpEx;
-
- $db = $this->new_dbal();
- $config = new phpbb_config(array());
- $request = $this->getMock('phpbb_request');
- $user = $this->getMock('phpbb_user');
-
- $auth_provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx);
- $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
- $phpbb_container->expects($this->any())
- ->method('get')
- ->with('auth.provider.db')
- ->will($this->returnValue($auth_provider));
-
- $session_factory = new phpbb_session_testable_factory;
- $session_factory->set_cookies(array(
- '_sid' => $session_id,
- '_u' => $user_id,
- ));
- $session_factory->merge_config_data(array(
- 'session_length' => time(), // need to do this to allow sessions started at time 0
- ));
- $session_factory->merge_server_data(array(
- 'HTTP_USER_AGENT' => $user_agent,
- 'REMOTE_ADDR' => $ip,
- ));
-
- $session = $session_factory->get_session($db);
- $session->page = array('page' => 'page', 'forum' => 0);
-
- $session->session_begin();
-
- $sql = 'SELECT session_id, session_user_id
- FROM phpbb_sessions
- ORDER BY session_user_id';
-
- $expected_sessions = $this->replace_session($expected_sessions, $session->session_id);
- $expected_cookies = $this->replace_session($expected_cookies, $session->session_id);
-
- $this->assertSqlResultEquals(
- $expected_sessions,
- $sql,
- $message
- );
-
- $session->check_cookies($this, $expected_cookies);
-
- $session_factory->check($this);
- }
-
- /**
- * Replaces recursively the value __new_session_id__ with the given session
- * id.
- *
- * @param array $array An array of data
- * @param string $session_id The new session id to use instead of the
- * placeholder.
- * @return array The input array with all occurances of __new_session_id__
- * replaced.
- */
- public function replace_session($array, $session_id)
- {
- foreach ($array as $key => &$value)
- {
- if ($value === '__new_session_id__')
- {
- $value = $session_id;
- }
-
- if (is_array($value))
- {
- $value = $this->replace_session($value, $session_id);
- }
- }
-
- return $array;
- }
-}
diff --git a/tests/session/create_test.php b/tests/session/create_test.php
new file mode 100644
index 0000000000..442445599b
--- /dev/null
+++ b/tests/session/create_test.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+
+class phpbb_session_create_test extends phpbb_session_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml');
+ }
+
+ static function bot($bot_agent, $user_id, $bot_ip)
+ {
+ return array(array(
+ 'bot_agent' => $bot_agent,
+ 'user_id' => $user_id,
+ 'bot_ip' => $bot_ip,
+ ));
+ }
+
+ function test_bot_session()
+ {
+ $output = $this->session_facade->session_create(
+ false,
+ false,
+ false,
+ false,
+ array(),
+ 'user agent',
+ '127.0.0.1',
+ self::bot('user agent', 13, '127.0.0.1'),
+ ''
+ );
+ $this->assertEquals(true, $output->data['is_bot'], 'should be a bot');
+ }
+}
diff --git a/tests/session/creation_test.php b/tests/session/creation_test.php
deleted file mode 100644
index fde76d6b06..0000000000
--- a/tests/session/creation_test.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-require_once dirname(__FILE__) . '/testable_factory.php';
-
-class phpbb_session_creation_test extends phpbb_database_test_case
-{
- public function getDataSet()
- {
- return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml');
- }
-
- // also see security/extract_current_page.php
-
- public function test_login_session_create()
- {
- global $phpbb_container, $phpbb_root_path, $phpEx;
-
- $db = $this->new_dbal();
- $config = new phpbb_config(array());
- $request = $this->getMock('phpbb_request');
- $user = $this->getMock('phpbb_user');
-
- $auth_provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx);
- $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
- $phpbb_container->expects($this->any())
- ->method('get')
- ->with('auth.provider.db')
- ->will($this->returnValue($auth_provider));
-
- $session_factory = new phpbb_session_testable_factory;
-
- $session = $session_factory->get_session($db);
- $session->page = array('page' => 'page', 'forum' => 0);
-
- $session->session_create(3);
-
- $sql = 'SELECT session_user_id
- FROM phpbb_sessions';
-
- $this->assertSqlResultEquals(
- array(array('session_user_id' => 3)),
- $sql,
- 'Check if exactly one session for user id 3 was created'
- );
-
- $one_year_in_seconds = 365 * 24 * 60 * 60;
- $cookie_expire = $session->time_now + $one_year_in_seconds;
-
- $session->check_cookies($this, array(
- 'u' => array(null, $cookie_expire),
- 'k' => array(null, $cookie_expire),
- 'sid' => array($session->session_id, $cookie_expire),
- ));
-
- global $SID, $_SID;
- $this->assertEquals($session->session_id, $_SID);
- $this->assertEquals('?sid=' . $session->session_id, $SID);
-
- $session_factory->check($this);
- }
-}
-
diff --git a/tests/session/extract_hostname_test.php b/tests/session/extract_hostname_test.php
new file mode 100644
index 0000000000..bd183fd438
--- /dev/null
+++ b/tests/session/extract_hostname_test.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+
+class phpbb_session_extract_hostname_test extends phpbb_session_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml');
+ }
+
+ static public function extract_current_hostname_data()
+ {
+ return array (
+ // [Input] $host, $server_name_config, $cookie_domain_config, [Expected] $output
+ // If host is ip use that
+ // ipv4
+ array('127.0.0.1', 'skipped.org', 'skipped.org', '127.0.0.1'),
+ // ipv6
+ array('::1', 'skipped.org', 'skipped.org', ':'),
+ array('2002::3235:51f9', 'skipped.org', 'skipped.org', '2002::3235'),
+ // If no host but server name matches cookie_domain use that
+ array('', 'example.org', 'example.org', 'example.org'),
+ // If there is a host uri use that
+ array('example.org', false, false, 'example.org'),
+ // 'best approach' guessing
+ array('', 'example.org', false, 'example.org'),
+ array('', false, '127.0.0.1', '127.0.0.1'),
+ array('', false, false, php_uname('n')),
+ );
+ }
+
+ /** @dataProvider extract_current_hostname_data */
+ function test_extract_current_hostname($host, $server_name_config, $cookie_domain_config, $expected)
+ {
+ $output = $this->session_facade->extract_current_hostname(
+ $host,
+ $server_name_config,
+ $cookie_domain_config
+ );
+
+ $this->assertEquals($expected, $output);
+ }
+}
diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php
new file mode 100644
index 0000000000..f4ae8de021
--- /dev/null
+++ b/tests/session/extract_page_test.php
@@ -0,0 +1,115 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+
+class phpbb_session_extract_page_test extends phpbb_session_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml');
+ }
+
+ static public function extract_current_page_data()
+ {
+ return array(
+ array(
+ './',
+ '/phpBB/index.php',
+ '',
+ '/phpBB/',
+ array(
+ 'page_name' => 'index.php',
+ 'page_dir' => '',
+ 'query_string' => '',
+ 'script_path' => '/phpBB/',
+ 'root_script_path' => '/phpBB/',
+ 'page' => 'index.php',
+ 'forum' => 0,
+ ),
+ ),
+ array(
+ './',
+ '/phpBB/ucp.php',
+ 'mode=login',
+ '/phpBB/ucp.php?mode=login',
+ array(
+ 'page_name' => 'ucp.php',
+ 'page_dir' => '',
+ 'query_string' => 'mode=login',
+ 'script_path' => '/phpBB/',
+ 'root_script_path' => '/phpBB/',
+ 'page' => 'ucp.php?mode=login',
+ 'forum' => 0,
+ ),
+ ),
+ array(
+ './',
+ '/phpBB/ucp.php',
+ 'mode=register',
+ '/phpBB/ucp.php?mode=register',
+ array(
+ 'page_name' => 'ucp.php',
+ 'page_dir' => '',
+ 'query_string' => 'mode=register',
+ 'script_path' => '/phpBB/',
+ 'root_script_path' => '/phpBB/',
+ 'page' => 'ucp.php?mode=register',
+ 'forum' => 0,
+ ),
+ ),
+ array(
+ './',
+ '/phpBB/ucp.php',
+ 'mode=register',
+ '/phpBB/ucp.php?mode=register',
+ array(
+ 'page_name' => 'ucp.php',
+ 'page_dir' => '',
+ 'query_string' => 'mode=register',
+ 'script_path' => '/phpBB/',
+ 'root_script_path' => '/phpBB/',
+ 'page' => 'ucp.php?mode=register',
+ 'forum' => 0,
+ ),
+ ),
+ array(
+ './../',
+ '/phpBB/adm/index.php',
+ 'sid=e7215d958cdd41a6fc13509bebe53e42',
+ '/phpBB/adm/index.php?sid=e7215d958cdd41a6fc13509bebe53e42',
+ array(
+ 'page_name' => 'index.php',
+ //'page_dir' => 'adm',
+ // ^-- Ignored because .. returns different directory in live vs testing
+ 'query_string' => '',
+ 'script_path' => '/phpBB/adm/',
+ 'root_script_path' => '/phpBB/',
+ //'page' => 'adm/index.php',
+ 'forum' => 0,
+ ),
+ ),
+ );
+ }
+
+ /** @dataProvider extract_current_page_data */
+ function test_extract_current_page($root_path, $php_self, $query_string, $request_uri, $expected)
+ {
+ $output = $this->session_facade->extract_current_page(
+ $root_path,
+ $php_self,
+ $query_string,
+ $request_uri
+ );
+
+ // This compares the result of the output.
+ // Any keys that are not in the expected array are overwritten by the output (aka not checked).
+ $this->assert_array_content_equals(array_merge($output, $expected), $output);
+ }
+}
diff --git a/tests/session/fixtures/sessions_banlist.xml b/tests/session/fixtures/sessions_banlist.xml
new file mode 100644
index 0000000000..9422fc0665
--- /dev/null
+++ b/tests/session/fixtures/sessions_banlist.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username_clean</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>1</value>
+ <value>anonymous</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+ <table name="phpbb_sessions">
+ <column>session_id</column>
+ <column>session_user_id</column>
+ <column>session_ip</column>
+ <column>session_browser</column>
+ <column>session_admin</column>
+ <row>
+ <value>bar_session000000000000000000000</value>
+ <value>4</value>
+ <value>127.0.0.1</value>
+ <value>user agent</value>
+ <value>1</value>
+ </row>
+ </table>
+ <table name="phpbb_banlist">
+ <column>ban_id</column>
+ <column>ban_userid</column>
+ <column>ban_ip</column>
+ <column>ban_email</column>
+ <column>ban_start</column>
+ <column>ban_end</column>
+ <column>ban_exclude</column>
+ <column>ban_reason</column>
+ <column>ban_give_reason</column>
+ <row>
+ <value>2</value>
+ <value>4</value>
+ <value>127.0.0.1</value>
+ <value>bar@example.org</value>
+ <value>1111</value>
+ <value>0</value>
+ <value>0</value>
+ <value>HAHAHA</value>
+ <value>1</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>0</value>
+ <value>127.1.1.1</value>
+ <value></value>
+ <value>1111</value>
+ <value>0</value>
+ <value>0</value>
+ <value>HAHAHA</value>
+ <value>1</value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/session/fixtures/sessions_full.xml b/tests/session/fixtures/sessions_full.xml
index 509687f4d2..6bbaf1c9d5 100644
--- a/tests/session/fixtures/sessions_full.xml
+++ b/tests/session/fixtures/sessions_full.xml
@@ -37,17 +37,20 @@
<column>session_user_id</column>
<column>session_ip</column>
<column>session_browser</column>
+ <column>session_admin</column>
<row>
<value>anon_session00000000000000000000</value>
<value>1</value>
<value>127.0.0.1</value>
<value>anonymous user agent</value>
+ <value>0</value>
</row>
<row>
<value>bar_session000000000000000000000</value>
<value>4</value>
<value>127.0.0.1</value>
<value>user agent</value>
+ <value>1</value>
</row>
</table>
</dataset>
diff --git a/tests/session/fixtures/sessions_garbage.xml b/tests/session/fixtures/sessions_garbage.xml
new file mode 100644
index 0000000000..23c44a975b
--- /dev/null
+++ b/tests/session/fixtures/sessions_garbage.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username_clean</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>4</value>
+ <value>bar</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+ <table name="phpbb_sessions">
+ <column>session_id</column>
+ <column>session_user_id</column>
+ <column>session_ip</column>
+ <column>session_browser</column>
+ <column>session_admin</column>
+ <row>
+ <value>anon_session00000000000000000000</value>
+ <value>1</value>
+ <value>127.0.0.1</value>
+ <value>anonymous user agent</value>
+ <value>0</value>
+ </row>
+ <row>
+ <value>bar_session000000000000000000000</value>
+ <value>4</value>
+ <value>127.0.0.1</value>
+ <value>user agent</value>
+ <value>1</value>
+ </row>
+ </table>
+ <table name="phpbb_login_attempts">
+ <column>attempt_ip</column>
+ <column>attempt_browser</column>
+ <column>attempt_forwarded_for</column>
+ <column>attempt_time</column>
+ <column>user_id</column>
+ <column>username</column>
+ <column>username_clean</column>
+ <row>
+ <value>127.0.0.1</value>
+ <value>browser</value>
+ <value></value>
+ <value>0001</value>
+ <value>4</value>
+ <value>bar</value>
+ <value>bar</value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/session/fixtures/sessions_key.xml b/tests/session/fixtures/sessions_key.xml
new file mode 100644
index 0000000000..246d284557
--- /dev/null
+++ b/tests/session/fixtures/sessions_key.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_sessions_keys">
+ <column>key_id</column>
+ <column>user_id</column>
+ <column>last_ip</column>
+ <column>last_login</column>
+ <row>
+ <value>a87ff679a2f3e71d9181a67b7542122c</value>
+ <value>4</value>
+ <value>127.0.0.1</value>
+ <value>0</value>
+ </row>
+ </table>
+ <table name="phpbb_sessions">
+ <column>session_id</column>
+ <column>session_user_id</column>
+ <column>session_ip</column>
+ <column>session_browser</column>
+ <row>
+ <value>bar_session000000000000000000000</value>
+ <value>4</value>
+ <value>127.0.0.1</value>
+ <value>user agent</value>
+ <value>1</value>
+ </row>
+ </table>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username_clean</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>4</value>
+ <value>bar</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php
new file mode 100644
index 0000000000..e7d01785dd
--- /dev/null
+++ b/tests/session/garbage_collection_test.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+
+class phpbb_session_garbage_collection_test extends phpbb_session_test_case
+{
+ public $session;
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_garbage.xml');
+ }
+
+ public function setUp()
+ {
+ parent::setUp();
+ $this->session = $this->session_factory->get_session($this->db);
+ }
+
+ public function test_cleanup_all()
+ {
+ $this->check_sessions_equals(
+ array(
+ array(
+ 'session_id' => 'anon_session00000000000000000000',
+ 'session_user_id' => 1,
+ ),
+ array(
+ 'session_id' => 'bar_session000000000000000000000',
+ 'session_user_id' => 4,
+ ),
+ ),
+ 'Before test, should have some sessions.'
+ );
+ // Set session length so it clears all
+ global $config;
+ $config['session_length'] = 0;
+ // There is an error unless the captcha plugin is set
+ $config['captcha_plugin'] = 'phpbb_captcha_nogd';
+ $this->session->session_gc();
+ $this->check_sessions_equals(
+ array(),
+ 'After setting session time to 0, should remove all.'
+ );
+ }
+}
diff --git a/tests/session/session_key_test.php b/tests/session/session_key_test.php
new file mode 100644
index 0000000000..1cf2101385
--- /dev/null
+++ b/tests/session/session_key_test.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+
+class phpbb_session_login_keys_test extends phpbb_session_test_case
+{
+ protected $user_id = 4;
+ protected $key_id = 4;
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_key.xml');
+ }
+
+ public function test_set_key_manually()
+ {
+ // With AutoLogin setup
+ $this->session_factory->merge_config_data(array('allow_autologin' => true));
+ $session = $this->session_factory->get_session($this->db);
+ // Using a user_id and key that is already in the database
+ $session->cookie_data['u'] = $this->user_id;
+ $session->cookie_data['k'] = $this->key_id;
+ // Try to access session
+ $session->session_create($this->user_id, false, $this->user_id);
+
+ $this->assertEquals($this->user_id, $session->data['user_id'], "session should automatically login");
+ }
+
+ public function test_reset_keys()
+ {
+ // With AutoLogin setup
+ $this->session_factory->merge_config_data(array('allow_autologin' => true));
+ $session = $this->session_factory->get_session($this->db);
+ // Reset of the keys for this user
+ $session->reset_login_keys($this->user_id);
+ // Using a user_id and key that was in the database (before reset)
+ $session->cookie_data['u'] = $this->user_id;
+ $session->cookie_data['k'] = $this->key_id;
+ // Try to access session
+ $session->session_create($this->user_id, false, $this->user_id);
+
+ $this->assertNotEquals($this->user_id, $session->data['user_id'], "session should be cleared");
+ }
+}
diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php
new file mode 100644
index 0000000000..9f0a3c5f59
--- /dev/null
+++ b/tests/session/testable_facade.php
@@ -0,0 +1,142 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/testable_factory.php';
+require_once dirname(__FILE__) . '/../../phpBB/phpbb/session.php';
+
+/**
+ * This class exists to expose session.php's functions in a more testable way.
+ *
+ * Since many functions in session.php have global variables inside the function,
+ * this exposes those functions through a testable facade that uses
+ * testable_factory's mock global variables to modify global variables used in
+ * the functions.
+ *
+ * This is using the facade pattern to provide a testable "front" to the
+ * functions in sessions.php.
+ *
+ */
+class phpbb_session_testable_facade
+{
+ protected $db;
+ protected $session_factory;
+
+ function __construct($db, $session_factory)
+ {
+ $this->db = $db;
+ $this->session_factory = $session_factory;
+ }
+
+ function extract_current_page(
+ $root_path,
+ $php_self,
+ $query_string,
+ $request_uri
+ )
+ {
+ $this->session_factory->get_session($this->db);
+ global $request;
+ $request->overwrite('PHP_SELF', $php_self, phpbb_request_interface::SERVER);
+ $request->overwrite('QUERY_STRING', $query_string, phpbb_request_interface::SERVER);
+ $request->overwrite('REQUEST_URI', $request_uri, phpbb_request_interface::SERVER);
+ return phpbb_session::extract_current_page($root_path);
+ }
+
+ function extract_current_hostname(
+ $host,
+ $server_name_config,
+ $cookie_domain_config
+ )
+ {
+ $session = $this->session_factory->get_session($this->db);
+ global $config, $request;
+ $config['server_name'] = $server_name_config;
+ $config['cookie_domain'] = $cookie_domain_config;
+ $request->overwrite('SERVER_NAME', $host, phpbb_request_interface::SERVER);
+ $request->overwrite('Host', $host, phpbb_request_interface::SERVER);
+ // Note: There is a php_uname function used as a fallthrough
+ // that this function doesn't override
+ return $session->extract_current_hostname();
+ }
+
+ /**
+ *
+ * This function has a lot of dependencies, so instead of naming them all,
+ * just ask for overrides
+ *
+ * @param update_session_page Boolean of whether to set page of the session
+ * @param config_overrides An array of overrides for the global config object
+ * @param request_overrides An array of overrides for the global request object
+ * @return boolean False if the user is identified, otherwise true.
+ */
+ function session_begin(
+ $update_session_page = true,
+ $config_overrides = array(),
+ $request_overrides = array(),
+ $cookies_overrides = array()
+ )
+ {
+ $this->session_factory->merge_config_data($config_overrides);
+ $this->session_factory->merge_server_data($request_overrides);
+ $this->session_factory->set_cookies($cookies_overrides);
+ $session = $this->session_factory->get_session($this->db);
+ $session->session_begin($update_session_page);
+ return $session;
+ }
+
+ function session_create(
+ $user_id = false,
+ $set_admin = false,
+ $persist_login = false,
+ $viewonline = true,
+ array $config_overrides = array(),
+ $user_agent = 'user agent',
+ $ip_address = '127.0.0.1',
+ array $bot_overrides = array(),
+ $uri_sid = ""
+ )
+ {
+ $this->session_factory->merge_config_data($config_overrides);
+ // Bots
+ $this->session_factory->merge_cache_data(array('_bots' => $bot_overrides));
+ global $request;
+ $session = $this->session_factory->get_session($this->db);
+ $session->browser = $user_agent;
+ $session->ip = $ip_address;
+ // Uri sid
+ if ($uri_sid)
+ {
+ $_GET['sid'] = $uri_sid;
+ }
+ $session->session_create($user_id, $set_admin, $persist_login, $viewonline);
+ return $session;
+ }
+
+ function validate_referer(
+ $check_script_path,
+ $referer,
+ $host,
+ $force_server_vars,
+ $server_port,
+ $server_name,
+ $root_script_path
+ )
+ {
+ $session = $this->session_factory->get_session($this->db);
+ global $config, $request;
+ $session->referer = $referer;
+ $session->page['root_script_path'] = $root_script_path;
+ $session->host = $host;
+ $config['force_server_vars'] = $force_server_vars;
+ $config['server_name'] = $server_name;
+ $request->overwrite('SERVER_PORT', $server_port, phpbb_request_interface::SERVER);
+ return $session->validate_referer($check_script_path);
+ }
+}
+
diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php
index 1e2b194ece..8733ce15ef 100644
--- a/tests/session/testable_factory.php
+++ b/tests/session/testable_factory.php
@@ -2,11 +2,14 @@
/**
*
* @package testing
-* @copyright (c) 2011 phpBB Group
+* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
+require_once dirname(__FILE__) . '/../mock/container_builder.php';
+require_once dirname(__FILE__) . '/../mock/auth_provider.php';
+
/**
* This class exists to setup an instance of phpbb's session class for testing.
*
@@ -16,6 +19,7 @@
*/
class phpbb_session_testable_factory
{
+ protected $container;
protected $config_data;
protected $cache_data;
protected $cookies;
@@ -65,7 +69,7 @@ class phpbb_session_testable_factory
public function get_session(phpbb_db_driver $dbal)
{
// set up all the global variables used by session
- global $SID, $_SID, $db, $config, $cache, $request;
+ global $SID, $_SID, $db, $config, $cache, $request, $phpbb_container;
$request = $this->request = new phpbb_mock_request(
array(),
@@ -83,6 +87,12 @@ class phpbb_session_testable_factory
$cache = $this->cache = new phpbb_mock_cache($this->get_cache_data());
$SID = $_SID = null;
+ $phpbb_container = $this->container = new phpbb_mock_container_builder();
+ $phpbb_container->set(
+ 'auth.provider.db',
+ new phpbb_mock_auth_provider()
+ );
+
$session = new phpbb_mock_session_testable;
return $session;
}
@@ -165,6 +175,32 @@ class phpbb_session_testable_factory
}
/**
+ * Set cookies, merge config and server data in one step.
+ *
+ * New values overwrite old ones.
+ *
+ * @param $session_id
+ * @param $user_id
+ * @param $user_agent
+ * @param $ip
+ * @param int $time
+ */
+ public function merge_test_data($session_id, $user_id, $user_agent, $ip, $time = 0)
+ {
+ $this->set_cookies(array(
+ '_sid' => $session_id,
+ '_u' => $user_id,
+ ));
+ $this->merge_config_data(array(
+ 'session_length' => time() + $time, // need to do this to allow sessions started at time 0
+ ));
+ $this->merge_server_data(array(
+ 'HTTP_USER_AGENT' => $user_agent,
+ 'REMOTE_ADDR' => $ip,
+ ));
+ }
+
+ /**
* Retrieve all server variables to be passed to the session.
*
* @return array Server variables
diff --git a/tests/session/unset_admin_test.php b/tests/session/unset_admin_test.php
new file mode 100644
index 0000000000..1d5b1759ab
--- /dev/null
+++ b/tests/session/unset_admin_test.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+
+class phpbb_session_unset_admin_test extends phpbb_session_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml');
+ }
+
+ function get_test_session()
+ {
+ return $this->session_facade->session_begin(
+ true,
+ // Config
+ array(
+ 'session_length' => time(), // need to do this to allow sessions started at time 0
+ ),
+ // Server
+ array(
+ 'HTTP_USER_AGENT' => "user agent",
+ 'REMOTE_ADDR' => "127.0.0.1",
+ ),
+ // Cookies
+ array(
+ '_sid' => 'bar_session000000000000000000000',
+ '_u' => 4,
+ )
+ );
+ }
+
+ public function test_unset_admin()
+ {
+ $session = $this->get_test_session();
+ $this->assertEquals(1, $session->data['session_admin'], 'should be an admin before test starts');
+ $session->unset_admin();
+ $session = $this->get_test_session();
+ $this->assertEquals(0, $session->data['session_admin'], 'should be not be an admin after unset_admin');
+ }
+}
diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php
new file mode 100644
index 0000000000..a302229287
--- /dev/null
+++ b/tests/session/validate_referrer_test.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+
+class phpbb_session_validate_referrer_test extends phpbb_session_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml');
+ }
+
+ static function referrer_inputs()
+ {
+ $ex = "example.org";
+ $alt = "example.com";
+ return array(
+ // checkpath referrer host forcevars port servername rootpath pass?
+ // 0 Referrer or host wasn't collected, therefore should validate
+ array(false, '', $ex, false, 80, $ex, '', true),
+ array(false, $ex, '', false, 80, $ex, '', true),
+ // 2 Referrer doesn't match host or server_name
+ array(false, $alt, $ex, false, 80, $ex, '', false),
+ // 3 Everything should check out
+ array(false, $ex, $ex, false, 80, $ex, '', true),
+ // 4 Check Script Path
+ array(true, $ex, $ex, false, 80, $ex, '', true),
+ array(true, "$ex/foo", $ex, false, 80, $ex, "/foo", true),
+ array(true, "$ex/bar", $ex, false, 80, $ex, "/foo", false),
+ // 7 Port (This is not checked unless path is checked)
+ array(true, "$ex:80/foo", "$ex:80", false, 80, "$ex:80", "/foo", true),
+ array(true, "$ex:80/bar", "$ex:80", false, 80, "$ex:80", "/foo", false),
+ array(true, "$ex:79/foo", "$ex:81", false, 81, "$ex:81", "/foo", false),
+ );
+ }
+
+ /** @dataProvider referrer_inputs */
+ function test_referrer_inputs(
+ $check_script_path,
+ $referrer,
+ $host,
+ $force_server_vars,
+ $server_port,
+ $server_name,
+ $root_script_path,
+ $pass_or_fail
+ )
+ {
+ // Referrer needs http:// because it's going to get stripped in function.
+ $referrer = $referrer ? 'http://' . $referrer : '';
+ $this->assertEquals(
+ $pass_or_fail,
+ $this->session_facade->validate_referer(
+ $check_script_path,
+ $referrer,
+ $host,
+ $force_server_vars,
+ $server_port,
+ $server_name,
+ $root_script_path
+ ),
+ "referrer should" . ($pass_or_fail ? '' : "n't") . " be validated");
+ }
+}
diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php
index ea5c30891b..b67fa123a1 100644
--- a/tests/template/template_includejs_test.php
+++ b/tests/template/template_includejs_test.php
@@ -26,19 +26,15 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes
),
array(
array('TEST' => 2),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?assets_version=0&assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?assets_version=0"></script>',
),
array(
array('TEST' => 3),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0&assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0"></script>',
),
array(
array('TEST' => 4),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&amp;assets_version=0&assets_version=1"></script>',
- ),
- array(
- array('TEST' => 5),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1;assets_version=0&assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&amp;assets_version=0"></script>',
),
array(
array('TEST' => 6),
@@ -62,19 +58,15 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes
),
array(
array('TEST' => 11),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/child_only.js?test1=1&amp;test2=2&assets_version=1#test3"></script>',
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/child_only.js?test1=1&amp;test2=2&amp;assets_version=1#test3"></script>',
),
array(
array('TEST' => 12),
- '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=1&amp;test2=2&assets_version=1#test3"></script>',
- ),
- array(
- array('TEST' => 13),
- '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=1;test2=2&assets_version=1#test3"></script>',
+ '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=1&amp;test2=2&amp;assets_version=1#test3"></script>',
),
array(
array('TEST' => 14),
- '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=&quot;&assets_version=1#test3"></script>',
+ '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=&quot;&amp;assets_version=1#test3"></script>',
),
array(
array('TEST' => 15),
@@ -82,12 +74,16 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes
),
array(
array('TEST' => 16),
- '<script type="text/javascript" src="http://phpbb.com/b.js?c=d&assets_version=1#f"></script>',
+ '<script type="text/javascript" src="http://phpbb.com/b.js?c=d&assets_version=2#f"></script>',
),
array(
array('TEST' => 17),
'<script type="text/javascript" src="//phpbb.com/b.js"></script>',
),
+ array(
+ array('TEST' => 18),
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&test2=0&amp;assets_version=1"></script>',
+ ),
);
}
diff --git a/tests/template/template_parser_test.php b/tests/template/template_parser_test.php
new file mode 100644
index 0000000000..c200770adf
--- /dev/null
+++ b/tests/template/template_parser_test.php
@@ -0,0 +1,29 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/template_test_case.php';
+
+class phpbb_template_template_parser_test extends phpbb_template_template_test_case
+{
+ public function test_set_filenames()
+ {
+ $this->template->set_filenames(array(
+ 'basic' => 'basic.html',
+ ));
+
+ $this->assertEquals("passpasspass<!-- DUMMY var -->", str_replace(array("\n", "\r", "\t"), '', $this->template->assign_display('basic')));
+
+ $this->template->set_filenames(array(
+ 'basic' => 'if.html',
+ ));
+
+ $this->assertEquals("03!false", str_replace(array("\n", "\r", "\t"), '', $this->template->assign_display('basic')));
+ }
+}
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 802f0c19ba..dd9ba21c26 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -151,7 +151,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(),
array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
array(),
- "xyz\nabc\nabc\nbar\nbar\nabc",
+ "xyz\nabc\n\$VALUE == 'abc'abc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?",
),
array(
'define_advanced.html',
diff --git a/tests/template/templates/define.html b/tests/template/templates/define.html
index 4e6d0ee793..66e874ca63 100644
--- a/tests/template/templates/define.html
+++ b/tests/template/templates/define.html
@@ -2,8 +2,15 @@
{$VALUE}
<!-- DEFINE $VALUE = 'abc' -->
{$VALUE}
+<!-- IF $VALUE != 'abc' -->
+$VALUE != 'abc'
+<!-- ELSEIF $VALUE == 'abc' -->
+$VALUE == 'abc'
+<!-- ENDIF -->
<!-- INCLUDE define_include.html -->
{$INCLUDED_VALUE}
{$VALUE}
<!-- UNDEFINE $VALUE -->
{$VALUE}
+<!-- DEFINE $VALUE = 'test!@#$%^&*()_-=+{}[]:;",<.>/?' -->
+{$VALUE}
diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html
index 3bcad76af5..0bcdf1a815 100644
--- a/tests/template/templates/includejs.html
+++ b/tests/template/templates/includejs.html
@@ -6,8 +6,6 @@
<!-- INCLUDEJS parent_and_child.js?test=1&assets_version=0 -->
<!-- ELSEIF TEST === 4 -->
<!-- INCLUDEJS parent_and_child.js?test=1&amp;assets_version=0 -->
-<!-- ELSEIF TEST === 5 -->
- <!-- INCLUDEJS parent_and_child.js?test=1;assets_version=0 -->
<!-- ELSEIF TEST === 6 -->
<!-- INCLUDEJS {PARENT} -->
<!-- ELSEIF TEST === 7 -->
@@ -24,15 +22,15 @@
<!-- INCLUDEJS {$TEST} -->
<!-- ELSEIF TEST === 12 -->
<!-- INCLUDEJS parent_only.js?test1=1&amp;test2=2#test3 -->
-<!-- ELSEIF TEST === 13 -->
- <!-- INCLUDEJS parent_only.js?test1=1;test2=2#test3 -->
<!-- ELSEIF TEST === 14 -->
<!-- INCLUDEJS parent_only.js?test1=&quot;#test3 -->
<!-- ELSEIF TEST === 15 -->
<!-- INCLUDEJS http://phpbb.com/b.js?c=d#f -->
<!-- ELSEIF TEST === 16 -->
- <!-- INCLUDEJS http://phpbb.com/b.js?c=d&assets_version=1#f -->
+ <!-- INCLUDEJS http://phpbb.com/b.js?c=d&assets_version=2#f -->
<!-- ELSEIF TEST === 17 -->
<!-- INCLUDEJS //phpbb.com/b.js -->
+<!-- ELSEIF TEST === 18 -->
+ <!-- INCLUDEJS parent_and_child.js?test=1&test2=0 -->
<!-- ENDIF -->
{$SCRIPTS}
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index f27e339bb7..de3611c4cc 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -610,7 +610,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$form = $crawler->selectButton($this->lang('LOGIN'))->form();
$crawler = self::submit($form, array('username' => $username, 'password' => $username . $username));
- $this->assertContains($this->lang('LOGIN_REDIRECT'), $crawler->filter('html')->text());
+ $this->assertNotContains($this->lang('LOGIN'), $crawler->filter('.navbar')->text());
$cookies = self::$cookieJar->all();
@@ -629,7 +629,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$this->add_lang('ucp');
$crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout');
- $this->assertContains($this->lang('LOGOUT_REDIRECT'), $crawler->filter('#message')->text());
+ $this->assertContains($this->lang('REGISTER'), $crawler->filter('.navbar')->text());
unset($this->sid);
}
@@ -659,7 +659,7 @@ class phpbb_functional_test_case extends phpbb_test_case
if (strpos($field, 'password_') === 0)
{
$crawler = self::submit($form, array('username' => $username, $field => $username . $username));
- $this->assertContains($this->lang('LOGIN_ADMIN_SUCCESS'), $crawler->filter('html')->text());
+ $this->assertContains($this->lang('ADMIN_PANEL'), $crawler->filter('h1')->text());
$cookies = self::$cookieJar->all();
@@ -743,9 +743,31 @@ class phpbb_functional_test_case extends phpbb_test_case
// Any output before the doc type means there was an error
$content = self::$client->getResponse()->getContent();
+ self::assertNotContains('[phpBB Debug]', $content);
self::assertStringStartsWith('<!DOCTYPE', trim($content), 'Output found before DOCTYPE specification.');
}
+ /*
+ * Perform some basic assertions for an xml page
+ *
+ * Checks for debug/error output before the actual page content and the status code
+ *
+ * @param mixed $status_code Expected status code, false to disable check
+ * @return null
+ */
+ static public function assert_response_xml($status_code = 200)
+ {
+ if ($status_code !== false)
+ {
+ self::assert_response_status_code($status_code);
+ }
+
+ // Any output before the xml opening means there was an error
+ $content = self::$client->getResponse()->getContent();
+ self::assertNotContains('[phpBB Debug]', $content);
+ self::assertStringStartsWith('<?xml', trim($content), 'Output found before XML specification.');
+ }
+
/**
* Heuristic function to check that the response is success.
*
@@ -870,6 +892,7 @@ class phpbb_functional_test_case extends phpbb_test_case
* Be sure to login before creating
*
* @param int $forum_id
+ * @param int $topic_id
* @param string $subject
* @param string $message
* @param array $additional_form_data Any additional form data to be sent in the request
@@ -926,18 +949,47 @@ class phpbb_functional_test_case extends phpbb_test_case
// Instead, I send it as a request with the submit button "post" set to true.
$crawler = self::request('POST', $posting_url, $form_data);
$this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text());
-
$url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri();
- $matches = $topic_id = $post_id = false;
- preg_match_all('#&t=([0-9]+)(&p=([0-9]+))?#', $url, $matches);
-
- $topic_id = (int) (isset($matches[1][0])) ? $matches[1][0] : 0;
- $post_id = (int) (isset($matches[3][0])) ? $matches[3][0] : 0;
-
return array(
- 'topic_id' => $topic_id,
- 'post_id' => $post_id,
+ 'topic_id' => $this->get_parameter_from_link($url, 't'),
+ 'post_id' => $this->get_parameter_from_link($url, 'p'),
);
}
+
+ /*
+ * Returns the requested parameter from a URL
+ *
+ * @param string $url
+ * @param string $parameter
+ * @return string Value of the parameter in the URL, null if not set
+ */
+ public function get_parameter_from_link($url, $parameter)
+ {
+ if (strpos($url, '?') === false)
+ {
+ return null;
+ }
+
+ $url_parts = explode('?', $url);
+ if (isset($url_parts[1]))
+ {
+ $url_parameters = $url_parts[1];
+ if (strpos($url_parameters, '#') !== false)
+ {
+ $url_parameters = explode('#', $url_parameters);
+ $url_parameters = $url_parameters[0];
+ }
+
+ foreach (explode('&', $url_parameters) as $url_param)
+ {
+ list($param, $value) = explode('=', $url_param);
+ if ($param == $parameter)
+ {
+ return $value;
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php
new file mode 100644
index 0000000000..e6a2b03bba
--- /dev/null
+++ b/tests/test_framework/phpbb_session_test_case.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ *
+ * @package testing
+ * @copyright (c) 2013 phpBB Group
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+ *
+ */
+
+require_once dirname(__FILE__) . '/../session/testable_factory.php';
+require_once dirname(__FILE__) . '/../session/testable_facade.php';
+
+abstract class phpbb_session_test_case extends phpbb_database_test_case
+{
+ protected $session_factory;
+ protected $session_facade;
+ protected $db;
+
+ function setUp()
+ {
+ parent::setUp();
+ $this->session_factory = new phpbb_session_testable_factory;
+ $this->db = $this->new_dbal();
+ $this->session_facade =
+ new phpbb_session_testable_facade($this->db, $this->session_factory);
+ }
+
+ protected function check_sessions_equals($expected_sessions, $message)
+ {
+ $sql = 'SELECT session_id, session_user_id
+ FROM phpbb_sessions
+ ORDER BY session_user_id';
+
+ $this->assertSqlResultEquals($expected_sessions, $sql, $message);
+ }
+}
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index 50b2bf03ec..3d9cd10f32 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -94,6 +94,9 @@ class phpbb_test_case_helpers
public function makedirs($path)
{
+ // PHP bug #55124 (fixed in 5.4.0)
+ $path = str_replace('/./', '/', $path);
+
mkdir($path, 0777, true);
}
diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php
index 1665c493be..8b9df33a63 100644
--- a/tests/upload/fileupload_test.php
+++ b/tests/upload/fileupload_test.php
@@ -10,6 +10,7 @@
require_once __DIR__ . '/../../phpBB/includes/functions.php';
require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
require_once __DIR__ . '/../../phpBB/includes/functions_upload.php';
+require_once __DIR__ . '/../mock/filespec.php';
class phpbb_fileupload_test extends phpbb_test_case
{
diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysql-travis.xml
index 2d6af0e2ac..715e66c223 100644
--- a/travis/phpunit-mysql-travis.xml
+++ b/travis/phpunit-mysql-travis.xml
@@ -15,6 +15,10 @@
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests/</directory>
<exclude>tests/functional</exclude>
+ <exclude>tests/lint_test.php</exclude>
+ </testsuite>
+ <testsuite name="phpBB Lint Test">
+ <file>tests/lint_test.php</file>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory>
diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml
index a9062efafb..c397882d3c 100644
--- a/travis/phpunit-postgres-travis.xml
+++ b/travis/phpunit-postgres-travis.xml
@@ -15,6 +15,7 @@
<testsuite name="phpBB Test Suite">
<directory suffix="_test.php">../tests/</directory>
<exclude>tests/functional</exclude>
+ <exclude>tests/lint_test.php</exclude>
</testsuite>
<testsuite name="phpBB Functional Tests">
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory>