aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--build/build.xml42
-rwxr-xr-xgit-tools/hooks/pre-commit57
-rwxr-xr-xgit-tools/merge.php21
-rwxr-xr-xgit-tools/setup_github_network.php92
-rw-r--r--phpBB/adm/style/acp_board.html2
-rw-r--r--phpBB/adm/style/acp_forums.html2
-rw-r--r--phpBB/adm/style/acp_icons.html4
-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.json6
-rw-r--r--phpBB/composer.lock253
-rw-r--r--phpBB/config/auth_providers.yml37
-rw-r--r--phpBB/config/feed.yml7
-rw-r--r--phpBB/config/services.yml21
-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.html59
-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/includes/acp/acp_bbcodes.php14
-rw-r--r--phpBB/includes/acp/acp_board.php126
-rw-r--r--phpBB/includes/acp/acp_captcha.php2
-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.php17
-rw-r--r--phpBB/includes/acp/acp_permission_roles.php25
-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/auth/auth_apache.php247
-rw-r--r--phpBB/includes/auth/auth_db.php289
-rw-r--r--phpBB/includes/auth/auth_ldap.php350
-rw-r--r--phpBB/includes/bbcode.php4
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php12
-rw-r--r--phpBB/includes/constants.php5
-rw-r--r--phpBB/includes/functions.php20
-rw-r--r--phpBB/includes/functions_acp.php2
-rw-r--r--phpBB/includes/functions_admin.php196
-rw-r--r--phpBB/includes/functions_container.php88
-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_jabber.php2
-rw-r--r--phpBB/includes/functions_messenger.php105
-rw-r--r--phpBB/includes/functions_module.php38
-rw-r--r--phpBB/includes/functions_posting.php567
-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/template/compile.php166
-rw-r--r--phpBB/includes/template/filter.php1260
-rw-r--r--phpBB/includes/template/renderer.php35
-rw-r--r--phpBB/includes/template/renderer_eval.php60
-rw-r--r--phpBB/includes/template/renderer_include.php60
-rw-r--r--phpBB/includes/template/template.php515
-rw-r--r--phpBB/includes/ucp/ucp_groups.php3
-rw-r--r--phpBB/includes/ucp/ucp_main.php6
-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.php8
-rw-r--r--phpBB/install/index.php8
-rw-r--r--phpBB/install/install_convert.php1
-rw-r--r--phpBB/install/install_install.php11
-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.php9
-rw-r--r--phpBB/language/en/acp/permissions.php2
-rw-r--r--phpBB/language/en/acp/permissions_phpbb.php8
-rw-r--r--phpBB/language/en/acp/posting.php3
-rw-r--r--phpBB/language/en/common.php12
-rw-r--r--phpBB/language/en/help_faq.php2
-rw-r--r--phpBB/language/en/install.php16
-rw-r--r--phpBB/language/en/mcp.php29
-rw-r--r--phpBB/language/en/migrator.php2
-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)9
-rw-r--r--phpBB/phpbb/auth/index.htm (renamed from phpBB/includes/auth/index.htm)0
-rw-r--r--phpBB/phpbb/auth/provider/apache.php259
-rw-r--r--phpBB/phpbb/auth/provider/base.php72
-rw-r--r--phpBB/phpbb/auth/provider/db.php297
-rw-r--r--phpBB/phpbb/auth/provider/index.htm (renamed from phpBB/includes/search/index.htm)0
-rw-r--r--phpBB/phpbb/auth/provider/interface.php105
-rw-r--r--phpBB/phpbb/auth/provider/ldap.php346
-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)0
-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)28
-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)2
-rw-r--r--phpBB/phpbb/db/driver/mssqlnative.php (renamed from phpBB/includes/db/driver/mssqlnative.php)10
-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.php57
-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.php51
-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)2
-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)6
-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/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)42
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php (renamed from phpBB/includes/search/fulltext_sphinx.php)25
-rw-r--r--phpBB/phpbb/search/index.htm10
-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)47
-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)76
-rw-r--r--phpBB/phpbb/template/asset.php182
-rw-r--r--phpBB/phpbb/template/context.php (renamed from phpBB/includes/template/context.php)34
-rw-r--r--phpBB/phpbb/template/locator.php (renamed from phpBB/includes/template/locator.php)0
-rw-r--r--phpBB/phpbb/template/template.php157
-rw-r--r--phpBB/phpbb/template/twig/definition.php69
-rw-r--r--phpBB/phpbb/template/twig/environment.php140
-rw-r--r--phpBB/phpbb/template/twig/extension.php188
-rw-r--r--phpBB/phpbb/template/twig/lexer.php300
-rw-r--r--phpBB/phpbb/template/twig/node/define.php58
-rw-r--r--phpBB/phpbb/template/twig/node/event.php79
-rw-r--r--phpBB/phpbb/template/twig/node/expression/binary/equalequal.php25
-rw-r--r--phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php25
-rw-r--r--phpBB/phpbb/template/twig/node/include.php56
-rw-r--r--phpBB/phpbb/template/twig/node/includeasset.php60
-rw-r--r--phpBB/phpbb/template/twig/node/includecss.php30
-rw-r--r--phpBB/phpbb/template/twig/node/includejs.php32
-rw-r--r--phpBB/phpbb/template/twig/node/includephp.php91
-rw-r--r--phpBB/phpbb/template/twig/node/php.php55
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/define.php66
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/event.php47
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/include.php46
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includecss.php38
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includejs.php47
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includephp.php56
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/php.php55
-rw-r--r--phpBB/phpbb/template/twig/twig.php465
-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.php186
-rw-r--r--phpBB/search.php58
-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/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.html6
-rw-r--r--phpBB/styles/prosilver/template/mcp_logs.html4
-rw-r--r--phpBB/styles/prosilver/template/mcp_notes_user.html4
-rw-r--r--phpBB/styles/prosilver/template/mcp_post.html18
-rw-r--r--phpBB/styles/prosilver/template/mcp_queue.html33
-rw-r--r--phpBB/styles/prosilver/template/mcp_reports.html4
-rw-r--r--phpBB/styles/prosilver/template/mcp_topic.html27
-rw-r--r--phpBB/styles/prosilver/template/memberlist_body.html4
-rw-r--r--phpBB/styles/prosilver/template/memberlist_search.html6
-rw-r--r--phpBB/styles/prosilver/template/overall_footer.html33
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html17
-rw-r--r--phpBB/styles/prosilver/template/posting_buttons.html7
-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/report_body.html4
-rw-r--r--phpBB/styles/prosilver/template/search_results.html5
-rw-r--r--phpBB/styles/prosilver/template/timezone_option.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_attachments.html4
-rw-r--r--phpBB/styles/prosilver/template/ucp_avatar_options.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_pm_viewfolder.html4
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html5
-rw-r--r--phpBB/styles/prosilver/template/viewonline_body.html4
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html61
-rw-r--r--phpBB/styles/prosilver/theme/buttons.css14
-rw-r--r--phpBB/styles/prosilver/theme/common.css32
-rw-r--r--phpBB/styles/prosilver/theme/content.css2
-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/overall_footer.html6
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html2
-rw-r--r--phpBB/styles/subsilver2/template/posting_body.html29
-rw-r--r--phpBB/styles/subsilver2/template/report_body.html8
-rw-r--r--phpBB/styles/subsilver2/template/search_results.html3
-rw-r--r--phpBB/styles/subsilver2/template/timezone_option.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_groups_manage.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_profile_avatar.html2
-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.php137
-rw-r--r--phpunit.xml.all9
-rw-r--r--phpunit.xml.dist9
-rw-r--r--phpunit.xml.functional9
-rw-r--r--tests/RUNNING_TESTS.md38
-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/auth/fixtures/user.xml33
-rw-r--r--tests/auth/provider_apache_test.php206
-rw-r--r--tests/auth/provider_db_test.php50
-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/helper_url_test.php8
-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/dbal/order_lower_test.php7
-rw-r--r--tests/di/create_container_test.php3
-rw-r--r--tests/error_collector_test.php1
-rw-r--r--tests/extension/finder_test.php8
-rw-r--r--tests/extension/metadata_manager_test.php5
-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/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/forum_style_test.php45
-rw-r--r--tests/functional/metadata_manager_test.php2
-rw-r--r--tests/functional/paging_test.php39
-rw-r--r--tests/functional/posting_test.php101
-rw-r--r--tests/functional/report_post_captcha.php61
-rw-r--r--tests/functional/softdelete_test.php761
-rw-r--r--tests/functions/get_remote_file_test.php75
-rw-r--r--tests/log/function_view_log_test.php1
-rw-r--r--tests/mock/search.php23
-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/continue_test.php13
-rw-r--r--tests/session/creation_test.php (renamed from tests/session/init_test.php)20
-rw-r--r--tests/template/includephp_test.php17
-rw-r--r--tests/template/invalid_constructs_test.php87
-rw-r--r--tests/template/parent_templates/parent_only.css0
-rw-r--r--tests/template/renderer_eval_test.php31
-rw-r--r--tests/template/subdir/includephp_from_subdir_test.php4
-rw-r--r--tests/template/template_compile_test.php31
-rw-r--r--tests/template/template_events_test.php20
-rw-r--r--tests/template/template_includecss_test.php28
-rw-r--r--tests/template/template_includejs_test.php94
-rw-r--r--tests/template/template_inheritance_test.php11
-rw-r--r--tests/template/template_locate_test.php68
-rw-r--r--tests/template/template_parser_test.php29
-rw-r--r--tests/template/template_spacing_test.php87
-rw-r--r--tests/template/template_test.php167
-rw-r--r--tests/template/template_test_case.php56
-rw-r--r--tests/template/template_test_case_with_tree.php2
-rw-r--r--tests/template/templates/child_only.css0
-rw-r--r--tests/template/templates/define_unclosed.html2
-rw-r--r--tests/template/templates/if.html8
-rw-r--r--tests/template/templates/includecss.html3
-rw-r--r--tests/template/templates/includejs.html44
-rw-r--r--tests/template/templates/invalid/include_nonexistent_file.html1
-rw-r--r--tests/template/templates/invalid/unknown_tag.html1
-rw-r--r--tests/template/templates/loop_nested.html8
-rw-r--r--tests/template/templates/loop_nested2.html6
-rw-r--r--tests/template/templates/loop_size.html2
-rw-r--r--tests/template/templates/loop_underscore.html2
-rw-r--r--tests/template/templates/loop_vars.html1
-rw-r--r--tests/template/templates/twig.html6
-rw-r--r--tests/template/templates/twig_parent.html7
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php294
-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.xml4
509 files changed, 12698 insertions, 5962 deletions
diff --git a/.gitignore b/.gitignore
index c757210654..06b13923f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
*~
/phpunit.xml
+/phpBB/cache/twig/*
/phpBB/cache/*.html
/phpBB/cache/*.php
/phpBB/cache/*.lock
diff --git a/build/build.xml b/build/build.xml
index 02518ac441..5b4cf8b496 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.
- -->
+ <!-- Install composer dependencies, if there are any. -->
<exec dir="."
- command="git ls-tree ${revision} composer.phar"
+ 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/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit
index 03babe47cd..06ba15c7fa 100755
--- a/git-tools/hooks/pre-commit
+++ b/git-tools/hooks/pre-commit
@@ -33,9 +33,7 @@ else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
-error=0
errors=""
-
if ! which "$PHP_BIN" >/dev/null 2>&1
then
echo "PHP Syntax check failed:"
@@ -73,63 +71,18 @@ do
# check the staged file content for syntax errors
# using php -l (lint)
- # note: if display_errors=stderr in php.ini,
- # parse errors are printed on stderr; otherwise
- # they are printed on stdout.
- # we filter everything other than parse errors
- # with a grep below, therefore it should be safe
- # to combine stdout and stderr in all circumstances
- result=$(git cat-file -p $sha | "$PHP_BIN" -l 2>&1)
+ result=$(git cat-file -p $sha | "$PHP_BIN" -n -l -ddisplay_errors\=1 -derror_reporting\=E_ALL -dlog_errrors\=0 2>&1)
if [ $? -ne 0 ]
then
- error=1
# Swap back in correct filenames
- errors=$(echo "$errors"; echo "$result" |sed -e "s@in - on@in $filename on@g")
+ errors=$(echo "$errors"; echo "$result" | grep ':' | sed -e "s@in - on@in $filename on@g")
fi
done
unset IFS
-if [ $error -eq 1 ]
+if [ -n "$errors" ]
then
- echo "PHP Syntax check failed:"
- # php "display errors" (display_errors php.ini value)
- # and "log errors" (log_errors php.ini value).
- # these are independent settings - see main/main.c in php source.
- # the "log errors" setting produces output which
- # starts with "PHP Parse error:"; the "display errors"
- # setting produces output starting with "Parse error:".
- # if both are turned on php dumps the parse error twice.
- # therefore here we try to grep for one version and
- # if that yields no results grep for the other version.
- #
- # other fun php facts:
- #
- # 1. in cli, display_errors and log_errors have different
- # destinations by default. display_errors prints to
- # standard output and log_errors prints to standard error.
- # whether these destinations make sense is left
- # as an exercise for the reader.
- # 2. as mentioned above, with all output turned on
- # php will print parse errors twice, one time on stdout
- # and one time on stderr.
- # 3. it is possible to set both display_errors and log_errors
- # to off. if this is done php will print the text
- # "Errors parsing <file>" but will not say what
- # the errors are. useful behavior, this.
- # 4. on my system display_errors defaults to on and
- # log_errors defaults to off, therefore providing
- # by default one copy of messages. your mileage may vary.
- # 5. by setting display_errors=stderr and log_errors=on,
- # both sets of messages will be printed on stderr.
- # 6. php-cgi binary, given display_errors=stderr and
- # log_errors=on, still prints both sets of messages
- # on stderr, but formats one set as an html fragment.
- # 7. your entry here? ;)
- $echo_e "$errors" | grep "^Parse error:"
- if [ $? -ne 0 ]
- then
- # match failed
- $echo_e "$errors" | grep "^PHP Parse error:"
- fi
+ echo "PHP Syntax check failed: "
+ $echo_e "$errors"
exit 1
fi
diff --git a/git-tools/merge.php b/git-tools/merge.php
index 41a96c0890..f6142095fb 100755
--- a/git-tools/merge.php
+++ b/git-tools/merge.php
@@ -124,19 +124,34 @@ function get_repository_url($username, $repository, $ssh = false)
function api_request($query)
{
- $contents = file_get_contents("http://github.com/api/v2/json/$query");
+ return api_url_request("https://api.github.com/$query?per_page=100");
+}
+
+function api_url_request($url)
+{
+ $contents = file_get_contents($url, false, stream_context_create(array(
+ 'http' => array(
+ 'header' => "User-Agent: phpBB/1.0\r\n",
+ ),
+ )));
if ($contents === false)
{
throw new RuntimeException("Error: failed to retrieve pull request data\n", 4);
}
+ $contents = json_decode($contents);
+
+ if (isset($contents->message) && strpos($contents->message, 'API Rate Limit') === 0)
+ {
+ throw new RuntimeException('Reached github API Rate Limit. Please try again later' . "\n", 4);
+ }
- return json_decode($contents);
+ return $contents;
}
function get_pull($username, $repository, $pull_id)
{
- $request = api_request("pulls/$username/$repository/$pull_id");
+ $request = api_request("repos/$username/$repository/pulls/$pull_id");
$pull = $request->pull;
diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php
index 5f2e1609a7..4e144edae6 100755
--- a/git-tools/setup_github_network.php
+++ b/git-tools/setup_github_network.php
@@ -15,14 +15,14 @@ function show_usage()
echo "$filename adds repositories of a github network as remotes to a local git repository.\n";
echo "\n";
- echo "Usage: [php] $filename -s collaborators|organisation|contributors|network [OPTIONS]\n";
+ echo "Usage: [php] $filename -s collaborators|organisation|contributors|forks [OPTIONS]\n";
echo "\n";
echo "Scopes:\n";
echo " collaborators Repositories of people who have push access to the specified repository\n";
echo " contributors Repositories of people who have contributed to the specified repository\n";
echo " organisation Repositories of members of the organisation at github\n";
- echo " network All repositories of the whole github network\n";
+ echo " forks All repositories of the whole github network\n";
echo "\n";
echo "Options:\n";
@@ -55,31 +55,31 @@ exit(work($scope, $username, $repository, $developer));
function work($scope, $username, $repository, $developer)
{
// Get some basic data
- $network = get_network($username, $repository);
+ $forks = get_forks($username, $repository);
$collaborators = get_collaborators($username, $repository);
- if ($network === false || $collaborators === false)
+ if ($forks === false || $collaborators === false)
{
- echo "Error: failed to retrieve network or collaborators\n";
+ echo "Error: failed to retrieve forks or collaborators\n";
return 1;
}
switch ($scope)
{
case 'collaborators':
- $remotes = array_intersect_key($network, $collaborators);
+ $remotes = array_intersect_key($forks, $collaborators);
break;
case 'organisation':
- $remotes = array_intersect_key($network, get_organisation_members($username));
+ $remotes = array_intersect_key($forks, get_organisation_members($username));
break;
case 'contributors':
- $remotes = array_intersect_key($network, get_contributors($username, $repository));
+ $remotes = array_intersect_key($forks, get_contributors($username, $repository));
break;
- case 'network':
- $remotes = $network;
+ case 'forks':
+ $remotes = $forks;
break;
default:
@@ -145,26 +145,66 @@ function get_repository_url($username, $repository, $ssh = false)
function api_request($query)
{
- $contents = file_get_contents("http://github.com/api/v2/json/$query");
+ return api_url_request("https://api.github.com/$query?per_page=100");
+}
+
+function api_url_request($url)
+{
+ $contents = file_get_contents($url, false, stream_context_create(array(
+ 'http' => array(
+ 'header' => "User-Agent: phpBB/1.0\r\n",
+ ),
+ )));
+
+ $sub_request_result = array();
+ // Check headers for pagination links
+ if (!empty($http_response_header))
+ {
+ foreach ($http_response_header as $header_element)
+ {
+ // Find Link Header which gives us a link to the next page
+ if (strpos($header_element, 'Link: ') === 0)
+ {
+ list($head, $header_content) = explode(': ', $header_element);
+ foreach (explode(', ', $header_content) as $links)
+ {
+ list($url, $rel) = explode('; ', $links);
+ if ($rel == 'rel="next"')
+ {
+ // Found a next link, follow it and merge the results
+ $sub_request_result = api_url_request(substr($url, 1, -1));
+ }
+ }
+ }
+ }
+ }
+
if ($contents === false)
{
return false;
}
- return json_decode($contents);
+ $contents = json_decode($contents);
+
+ if (isset($contents->message) && strpos($contents->message, 'API Rate Limit') === 0)
+ {
+ throw new RuntimeException('Reached github API Rate Limit. Please try again later' . "\n", 4);
+ }
+
+ return ($sub_request_result) ? array_merge($sub_request_result, $contents) : $contents;
}
function get_contributors($username, $repository)
{
- $request = api_request("repos/show/$username/$repository/contributors");
+ $request = api_request("repos/$username/$repository/stats/contributors");
if ($request === false)
{
return false;
}
$usernames = array();
- foreach ($request->contributors as $contributor)
+ foreach ($request as $contribution)
{
- $usernames[$contributor->login] = $contributor->login;
+ $usernames[$contribution->author->login] = $contribution->author->login;
}
return $usernames;
@@ -172,14 +212,14 @@ function get_contributors($username, $repository)
function get_organisation_members($username)
{
- $request = api_request("organizations/$username/public_members");
+ $request = api_request("orgs/$username/public_members");
if ($request === false)
{
return false;
}
$usernames = array();
- foreach ($request->users as $member)
+ foreach ($request as $member)
{
$usernames[$member->login] = $member->login;
}
@@ -189,35 +229,35 @@ function get_organisation_members($username)
function get_collaborators($username, $repository)
{
- $request = api_request("repos/show/$username/$repository/collaborators");
+ $request = api_request("repos/$username/$repository/collaborators");
if ($request === false)
{
return false;
}
$usernames = array();
- foreach ($request->collaborators as $collaborator)
+ foreach ($request as $collaborator)
{
- $usernames[$collaborator] = $collaborator;
+ $usernames[$collaborator->login] = $collaborator->login;
}
return $usernames;
}
-function get_network($username, $repository)
+function get_forks($username, $repository)
{
- $request = api_request("repos/show/$username/$repository/network");
+ $request = api_request("repos/$username/$repository/forks");
if ($request === false)
{
return false;
}
$usernames = array();
- foreach ($request->network as $network)
+ foreach ($request as $fork)
{
- $usernames[$network->owner] = array(
- 'username' => $network->owner,
- 'repository' => $network->name,
+ $usernames[$fork->owner->login] = array(
+ 'username' => $fork->owner->login,
+ 'repository' => $fork->name,
);
}
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/acp_forums.html b/phpBB/adm/style/acp_forums.html
index 38369ee207..7b1466cfbd 100644
--- a/phpBB/adm/style/acp_forums.html
+++ b/phpBB/adm/style/acp_forums.html
@@ -437,7 +437,7 @@
</div>
<!-- ENDIF -->
- <p><strong>{NAVIGATION}<!-- IF S_NO_FORUMS --> [<a href="{U_EDIT}">{L_EDIT}</a> | <a href="{U_DELETE}">{L_DELETE}</a><!-- IF not S_LINK --> | <a href="{U_SYNC}">{L_RESYNC}</a><!-- ENDIF --->]<!-- ENDIF --></strong></p>
+ <p><strong>{NAVIGATION}<!-- IF S_NO_FORUMS --> [<a href="{U_EDIT}">{L_EDIT}</a> | <a href="{U_DELETE}">{L_DELETE}</a><!-- IF not S_LINK --> | <a href="{U_SYNC}">{L_RESYNC}</a><!-- ENDIF -->]<!-- ENDIF --></strong></p>
<!-- IF .forums -->
<table cellspacing="1">
diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html
index 373a7b890c..eca02d2798 100644
--- a/phpBB/adm/style/acp_icons.html
+++ b/phpBB/adm/style/acp_icons.html
@@ -243,8 +243,8 @@
<td style="text-align: center;">{items.EMOTION}</td>
<!-- ENDIF -->
<td style="text-align: right; white-space: nowrap;">
- <!-- IF items.S_FIRST_ROW and not PREVIOUS_PAGE -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->&nbsp;
- <!-- IF items.S_LAST_ROW and not NEXT_PAGE -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
+ <!-- IF items.S_FIRST_ROW and not U_PREVIOUS_PAGE -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->&nbsp;
+ <!-- IF items.S_LAST_ROW and not U_NEXT_PAGE -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
&nbsp;<a href="{items.U_EDIT}">{ICON_EDIT}</a> <a href="{items.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a>
</td>
</tr>
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 abc1df57b7..bf693d1950 100644
--- a/phpBB/composer.json
+++ b/phpBB/composer.json
@@ -6,11 +6,13 @@
"symfony/event-dispatcher": "2.1.*",
"symfony/http-kernel": "2.1.*",
"symfony/routing": "2.1.*",
- "symfony/yaml": "2.1.*"
+ "symfony/yaml": "2.1.*",
+ "twig/twig": "1.13.*"
},
"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 e3b564fb1a..1ba6cb6f83 100644
--- a/phpBB/composer.lock
+++ b/phpBB/composer.lock
@@ -3,21 +3,21 @@
"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": "3792dc25490f24210ece3b40789c5b98",
+ "hash": "6e6125b88160e28568edcb9fd007abed",
"packages": [
{
"name": "symfony/config",
- "version": "v2.1.10",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config.git",
- "reference": "v2.1.10"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Config/zipball/v2.1.10",
- "reference": "v2.1.10",
+ "url": "https://api.github.com/repos/symfony/Config/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -45,21 +45,21 @@
],
"description": "Symfony Config Component",
"homepage": "http://symfony.com",
- "time": "2013-04-22 04:28:40"
+ "time": "2013-05-09 15:22:40"
},
{
"name": "symfony/dependency-injection",
- "version": "v2.1.10",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/DependencyInjection",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection.git",
- "reference": "v2.1.10"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.1.10",
- "reference": "v2.1.10",
+ "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -99,17 +99,17 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.1.10",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
- "reference": "v2.1.10"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.1.10",
- "reference": "v2.1.10",
+ "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -148,17 +148,17 @@
},
{
"name": "symfony/http-foundation",
- "version": "v2.1.10",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/HttpFoundation",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git",
- "reference": "v2.1.10"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.1.10",
- "reference": "v2.1.10",
+ "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -187,21 +187,21 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "http://symfony.com",
- "time": "2013-04-30 17:01:33"
+ "time": "2013-05-26 18:42:07"
},
{
"name": "symfony/http-kernel",
- "version": "v2.1.10",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/HttpKernel",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel.git",
- "reference": "v2.1.10"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.1.10",
- "reference": "v2.1.10",
+ "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -249,21 +249,21 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "http://symfony.com",
- "time": "2013-05-06 11:01:51"
+ "time": "2013-06-02 12:29:05"
},
{
"name": "symfony/routing",
- "version": "v2.1.9",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing.git",
- "reference": "v2.1.9"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.1.9",
- "reference": "v2.1.9",
+ "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -302,21 +302,21 @@
],
"description": "Symfony Routing Component",
"homepage": "http://symfony.com",
- "time": "2013-03-23 07:47:35"
+ "time": "2013-05-06 10:48:41"
},
{
"name": "symfony/yaml",
- "version": "v2.1.9",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
- "reference": "v2.1.9"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.1.9",
- "reference": "v2.1.9",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -344,7 +344,56 @@
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
- "time": "2013-03-23 01:54:33"
+ "time": "2013-05-10 00:09:46"
+ },
+ {
+ "name": "twig/twig",
+ "version": "v1.13.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/fabpot/Twig.git",
+ "reference": "v1.13.1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/fabpot/Twig/zipball/v1.13.1",
+ "reference": "v1.13.1",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.2.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.13-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Twig_": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Armin Ronacher",
+ "email": "armin.ronacher@active-4.com"
+ }
+ ],
+ "description": "Twig, the flexible, fast, and secure template language for PHP",
+ "homepage": "http://twig.sensiolabs.org",
+ "keywords": [
+ "templating"
+ ],
+ "time": "2013-06-06 06:06:01"
}
],
"packages-dev": [
@@ -493,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": {
@@ -552,16 +653,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "1.2.9",
+ "version": "1.2.12",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "1.2.9"
+ "reference": "1.2.12"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.9",
- "reference": "1.2.9",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.12",
+ "reference": "1.2.12",
"shasum": ""
},
"require": {
@@ -570,11 +671,19 @@
"phpunit/php-text-template": ">=1.1.1@stable",
"phpunit/php-token-stream": ">=1.1.3@stable"
},
+ "require-dev": {
+ "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/"
@@ -601,7 +710,7 @@
"testing",
"xunit"
],
- "time": "2013-02-26 18:55:56"
+ "time": "2013-07-06 06:26:16"
},
{
"name": "phpunit/php-file-iterator",
@@ -783,16 +892,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "3.7.19",
+ "version": "3.7.22",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "3.7.19"
+ "reference": "3.7.22"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.19",
- "reference": "3.7.19",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.22",
+ "reference": "3.7.22",
"shasum": ""
},
"require": {
@@ -801,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.0,<2.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"
@@ -853,7 +962,7 @@
"testing",
"xunit"
],
- "time": "2013-03-25 11:45:06"
+ "time": "2013-07-06 06:29:15"
},
{
"name": "phpunit/phpunit-mock-objects",
@@ -906,17 +1015,17 @@
},
{
"name": "symfony/browser-kit",
- "version": "v2.1.10",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/BrowserKit",
"source": {
"type": "git",
"url": "https://github.com/symfony/BrowserKit.git",
- "reference": "v2.1.10"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/v2.1.10",
- "reference": "v2.1.10",
+ "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -956,17 +1065,17 @@
},
{
"name": "symfony/css-selector",
- "version": "v2.1.10",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/CssSelector",
"source": {
"type": "git",
"url": "https://github.com/symfony/CssSelector.git",
- "reference": "v2.1.10"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/CssSelector/zipball/v2.1.10",
- "reference": "v2.1.10",
+ "url": "https://api.github.com/repos/symfony/CssSelector/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -994,21 +1103,21 @@
],
"description": "Symfony CssSelector Component",
"homepage": "http://symfony.com",
- "time": "2013-01-09 08:51:07"
+ "time": "2013-05-17 00:31:34"
},
{
"name": "symfony/dom-crawler",
- "version": "v2.1.10",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/DomCrawler",
"source": {
"type": "git",
"url": "https://github.com/symfony/DomCrawler.git",
- "reference": "v2.1.10"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/v2.1.10",
- "reference": "v2.1.10",
+ "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -1042,21 +1151,21 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "http://symfony.com",
- "time": "2013-03-27 17:13:16"
+ "time": "2013-05-16 00:06:15"
},
{
"name": "symfony/finder",
- "version": "v2.1.10",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
"url": "https://github.com/symfony/Finder.git",
- "reference": "v2.1.10"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.1.10",
- "reference": "v2.1.10",
+ "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -1084,21 +1193,21 @@
],
"description": "Symfony Finder Component",
"homepage": "http://symfony.com",
- "time": "2013-03-06 19:26:55"
+ "time": "2013-05-25 15:47:15"
},
{
"name": "symfony/process",
- "version": "v2.1.9",
+ "version": "v2.1.11",
"target-dir": "Symfony/Component/Process",
"source": {
"type": "git",
"url": "https://github.com/symfony/Process.git",
- "reference": "v2.1.9"
+ "reference": "v2.1.11"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Process/zipball/v2.1.9",
- "reference": "v2.1.9",
+ "url": "https://api.github.com/repos/symfony/Process/zipball/v2.1.11",
+ "reference": "v2.1.11",
"shasum": ""
},
"require": {
@@ -1126,7 +1235,7 @@
],
"description": "Symfony Process Component",
"homepage": "http://symfony.com",
- "time": "2013-03-23 07:44:01"
+ "time": "2013-05-06 10:21:56"
}
],
"aliases": [
diff --git a/phpBB/config/auth_providers.yml b/phpBB/config/auth_providers.yml
new file mode 100644
index 0000000000..bcc448e4d7
--- /dev/null
+++ b/phpBB/config/auth_providers.yml
@@ -0,0 +1,37 @@
+services:
+ auth.provider_collection:
+ class: phpbb_di_service_collection
+ arguments:
+ - @service_container
+ tags:
+ - { name: service_collection, tag: auth.provider }
+ auth.provider.db:
+ class: phpbb_auth_provider_db
+ arguments:
+ - @dbal.conn
+ - @config
+ - @request
+ - @user
+ - %core.root_path%
+ - %core.php_ext%
+ tags:
+ - { name: auth.provider }
+ auth.provider.apache:
+ class: phpbb_auth_provider_apache
+ arguments:
+ - @dbal.conn
+ - @config
+ - @request
+ - @user
+ - %core.root_path%
+ - %core.php_ext%
+ tags:
+ - { name: auth.provider }
+ auth.provider.ldap:
+ class: phpbb_auth_provider_ldap
+ arguments:
+ - @dbal.conn
+ - @config
+ - @user
+ tags:
+ - { name: auth.provider }
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 bb96953bcf..c1579cfb57 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -5,6 +5,7 @@ imports:
- { resource: migrator.yml }
- { resource: avatars.yml }
- { resource: feed.yml }
+ - { resource: auth_providers.yml }
services:
auth:
@@ -65,6 +66,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:
@@ -78,7 +92,7 @@ services:
arguments:
- @user
- @service_container
- - @ext.finder
+ - @style
cron.task_collection:
class: phpbb_di_service_collection
@@ -112,7 +126,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
@@ -254,15 +267,15 @@ services:
class: phpbb_style_path_provider
template:
- class: phpbb_template
+ class: phpbb_template_twig
arguments:
- %core.root_path%
- %core.php_ext%
- @config
- @user
- - @style.resource_locator
- @template_context
- @ext.manager
+ - %core.adm_relative_path%
template_context:
class: phpbb_template_context
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 164c4a2f55..899ca64fb5 100644
--- a/phpBB/docs/README.html
+++ b/phpBB/docs/README.html
@@ -34,7 +34,7 @@
<!-- BEGIN DOCUMENT -->
- <p>Thank you for downloading phpBB3. This README will guide through the basics of installation and operation of phpBB3. Please ensure you read this and the accompanying documentation fully <strong>before</strong> proceeding with the installation.</p>
+ <p>Thank you for downloading phpBB3. This README will guide you through the basics of installation and operation of phpBB3. Please ensure you read this and the accompanying documentation fully <strong>before</strong> proceeding with the installation.</p>
<h1>Readme</h1>
@@ -61,7 +61,7 @@
</ol>
</li>
<li><a href="#status">Status of this version</a></li>
- <li><a href="#bugs">Reporting Bugs</a>
+ <li><a href="#bugs">Reporting bugs</a>
<ol style="list-style-type: lower-roman;">
<li><a href="#securitybugs">Security related bugs</a></li>
</ol>
@@ -84,12 +84,11 @@
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
-
- <p>Installation, update and conversion instructions can be found in the <a href="INSTALL.html">INSTALL</a> document contained in this distribution. If you are intending to convert from a previous phpBB 2.0.x or 3.0.x installation we highly recommend you backup any existing data before proceeding!</p>
+ <p>Installation, update and conversion instructions can be found in the <a href="INSTALL.html">INSTALL</a> document in this directory. If you are intending on converting from a phpBB 2.0.x or 3.0.x installation we highly recommend that you backup any existing data before proceeding!</p>
<p>Users of phpBB 3.0 and 3.1 Beta versions cannot directly update.</p>
- <p>Please note that we won't support the following installation types:</p>
+ <p>Please note that we don't support the following installation types:</p>
<ul>
<li>Updates from phpBB 3.0 Beta versions to phpBB 3.0 RC1 and higher</li>
<li>Updates from phpBB 3.1 Beta versions to phpBB 3.1 RC1 and higher</li>
@@ -103,8 +102,8 @@
<li>Updates from phpBB 3.0 RC1 and 3.1 RC1 to the latest version</li>
<li>Note: if using the <em>Automatic Update Package</em>, updates are supported from phpBB 3.0.2 onward. To update a pre-3.0.2 installation, first update to 3.0.2 and then update to the current version.</li>
<li>Conversions from phpBB 2.0.x to the latest version</li>
- <li>New installations of phpBB 3.0.x - always only the latest released version</li>
- <li>New installations of phpBB 3.1.x - always only the latest released version</li>
+ <li>New installations of phpBB 3.0.x - only the latest released version</li>
+ <li>New installations of phpBB 3.1.x - only the latest released version</li>
</ul>
</div>
@@ -127,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. So please, do not ask for help in these cases!</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>
@@ -151,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>
@@ -175,35 +174,35 @@
<div class="content">
- <p>phpBB3 can seem a little daunting to new users in places, particularly with regard the permission system. The first thing you should do is check the <a href="FAQ.html">FAQ</a> which covers a few basic getting started questions. If you need additional help there are several places you should look.</p>
+ <p>phpBB3 can sometimes seem a little daunting to new users, particularly with regards to the permission system. The first thing you should do is check the <a href="FAQ.html">FAQ</a>, which covers a few basic getting started questions. If you need additional help there are several places you can find it.</p>
<a name="docs"></a><h3>3.i. phpBB3 Documentation</h3>
- <p>A comprehensive documentation is now available online and can be accessed from the following location:</p>
+ <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 through setting permissions and managing users.</p>
+ <p>This covers everything from installation to setting permissions and managing users.</p>
<a name="kb"></a><h3>3.ii. Knowledge Base</h3>
<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. This may well save both you and us time and allow the developer, moderator and support groups to spend more time responding to people with unknown issues and problems. Please also remember that phpBB is an entirely volunteer effort, no one receives any compensation for the time they give, this includes moderators as well as developers. So please be respectful and mindful when awaiting responses.</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>
<a name="irc"></a><h3>3.iv Internet Relay Chat</h3>
<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>
@@ -268,7 +267,7 @@
<p>The relevant database type/version is listed within the administration control panel.</p>
- <p>Please also be as detailed as you can in your report, if possible list the steps required to duplicate the problem. If you have a patch that fixes the issue, please attach it to the ticket or submit a pull request <a href="https://github.com/phpbb/phpbb3">on GitHub</a>.</p>
+ <p>Please be as detailed as you can in your report, and if possible, list the steps required to duplicate the problem. If you have a patch that fixes the issue, please attach it to the ticket or submit a pull request to our repository <a href="https://github.com/phpbb/phpbb3">on GitHub</a>.</p>
<p>If you create a patch, it is very much appreciated (but not required) if you follow the phpBB coding guidelines. Please note that the coding guidelines are somewhat different between different versions of phpBB. For phpBB 3.1.x the coding guidelines may be found here: <a href="http://area51.phpbb.com/docs/31x/coding-guidelines.html">http://area51.phpbb.com/docs/31x/coding-guidelines.html</a></p>
@@ -278,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>
@@ -299,8 +298,8 @@
<p>This list is not complete but does represent those bugs which may affect users on a wider scale. Other bugs listed in the tracker have typically been shown to be limited to certain setups or methods of installation, updating and/or conversions.</p>
<ul>
- <li>Conversions may fail to complete on large boards under some hosts</li>
- <li>Updates may fail to complete on large update sets under some hosts</li>
+ <li>Conversions may fail to complete on large boards under some hosts.</li>
+ <li>Updates may fail to complete on large update sets under some hosts.</li>
<li>Smilies placed directly after bbcode tags will not get parsed. Smilies always need to be separated by spaces.</li>
</ul>
@@ -322,7 +321,7 @@
<p>phpBB 3.1.x takes advantage of new features added in PHP 5.3. We recommend that you upgrade to the latest stable release of PHP5 to run phpBB. The minimum version required is PHP 5.3.3.</p>
- <p>Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.</p>
+ <p>Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.</p>
<p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and Firebird. Versions of PHP used range from 5.3.x to 5.4.x without problem.</p>
@@ -346,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/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index e537d7a8b9..9c430b5a0b 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -112,8 +112,8 @@ class acp_bbcodes
{
$template->assign_block_vars('token', array(
'TOKEN' => '{' . $token . '}',
- 'EXPLAIN' => $token_explain)
- );
+ 'EXPLAIN' => ($token === 'LOCAL_URL') ? sprintf($token_explain, generate_board_url() . '/') : $token_explain,
+ ));
}
return;
@@ -347,6 +347,9 @@ class acp_bbcodes
'LOCAL_URL' => array(
'!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')"
),
+ 'RELATIVE_URL' => array(
+ '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')"
+ ),
'EMAIL' => array(
'!(' . get_preg_expression('email') . ')!ie' => "\$this->bbcode_specialchars('$1')"
),
@@ -373,6 +376,7 @@ class acp_bbcodes
$sp_tokens = array(
'URL' => '(?i)((?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))(?-i)',
'LOCAL_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)',
+ 'RELATIVE_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)',
'EMAIL' => '(' . get_preg_expression('email') . ')',
'TEXT' => '(.*?)',
'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)',
@@ -429,7 +433,11 @@ class acp_bbcodes
$fp_replace = str_replace($token, $replace, $fp_replace);
$sp_match = str_replace(preg_quote($token, '!'), $sp_tokens[$token_type], $sp_match);
- $sp_replace = str_replace($token, '${' . ($n + 1) . '}', $sp_replace);
+
+ // Prepend the board url to local relative links
+ $replace_prepend = ($token_type === 'LOCAL_URL') ? generate_board_url() . '/' : '';
+
+ $sp_replace = str_replace($token, $replace_prepend . '${' . ($n + 1) . '}', $sp_replace);
}
$fp_match = '!' . $fp_match . '!' . $modifiers;
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 6881e03fdb..12e2a1bf72 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -522,84 +522,54 @@ class acp_board
if ($mode == 'auth')
{
// Retrieve a list of auth plugins and check their config values
- $auth_plugins = array();
+ $auth_providers = $phpbb_container->get('auth.provider_collection');
- $dp = @opendir($phpbb_root_path . 'includes/auth');
-
- if ($dp)
+ $updated_auth_settings = false;
+ $old_auth_config = array();
+ foreach ($auth_providers as $provider)
{
- while (($file = readdir($dp)) !== false)
+ if ($fields = $provider->acp())
{
- if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
+ // Check if we need to create config fields for this plugin and save config when submit was pressed
+ foreach ($fields as $field)
{
- $auth_plugins[] = basename(preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file));
- }
- }
- closedir($dp);
+ if (!isset($config[$field]))
+ {
+ set_config($field, '');
+ }
- sort($auth_plugins);
- }
+ if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false)
+ {
+ continue;
+ }
- $updated_auth_settings = false;
- $old_auth_config = array();
- foreach ($auth_plugins as $method)
- {
- if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
- {
- include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
+ $old_auth_config[$field] = $this->new_config[$field];
+ $config_value = $cfg_array[$field];
+ $this->new_config[$field] = $config_value;
- $method = 'acp_' . $method;
- if (function_exists($method))
- {
- if ($fields = $method($this->new_config))
+ if ($submit)
{
- // Check if we need to create config fields for this plugin and save config when submit was pressed
- foreach ($fields['config'] as $field)
- {
- if (!isset($config[$field]))
- {
- set_config($field, '');
- }
-
- if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false)
- {
- continue;
- }
-
- $old_auth_config[$field] = $this->new_config[$field];
- $config_value = $cfg_array[$field];
- $this->new_config[$field] = $config_value;
-
- if ($submit)
- {
- $updated_auth_settings = true;
- set_config($field, $config_value);
- }
- }
+ $updated_auth_settings = true;
+ set_config($field, $config_value);
}
- unset($fields);
}
}
+ unset($fields);
}
if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings))
{
$method = basename($cfg_array['auth_method']);
- if ($method && in_array($method, $auth_plugins))
+ if (array_key_exists('auth.provider.' . $method, $auth_providers))
{
- include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
-
- $method = 'init_' . $method;
- if (function_exists($method))
+ $provider = $auth_providers['auth.provider.' . $method];
+ if ($error = $provider->init())
{
- if ($error = $method())
+ foreach ($old_auth_config as $config_name => $config_value)
{
- foreach ($old_auth_config as $config_name => $config_value)
- {
- set_config($config_name, $config_value);
- }
- trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
+ set_config($config_name, $config_value);
}
+ trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
}
set_config('auth_method', basename($cfg_array['auth_method']));
}
@@ -683,23 +653,15 @@ class acp_board
{
$template->assign_var('S_AUTH', true);
- foreach ($auth_plugins as $method)
+ foreach ($auth_providers as $provider)
{
- if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
+ $auth_tpl = $provider->get_acp_template($this->new_config);
+ if ($auth_tpl)
{
- $method = 'acp_' . $method;
- if (function_exists($method))
- {
- $fields = $method($this->new_config);
-
- if ($fields['tpl'])
- {
- $template->assign_block_vars('auth_tpl', array(
- 'TPL' => $fields['tpl'])
- );
- }
- unset($fields);
- }
+ $template->assign_vars($auth_tpl['TEMPLATE_VARS']);
+ $template->assign_block_vars('auth_tpl', array(
+ 'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'],
+ ));
}
}
}
@@ -710,25 +672,19 @@ class acp_board
*/
function select_auth_method($selected_method, $key = '')
{
- global $phpbb_root_path, $phpEx;
+ global $phpbb_root_path, $phpEx, $phpbb_container;
$auth_plugins = array();
+ $auth_providers = $phpbb_container->get('auth.provider_collection');
- $dp = @opendir($phpbb_root_path . 'includes/auth');
-
- if (!$dp)
- {
- return '';
- }
-
- while (($file = readdir($dp)) !== false)
+ foreach ($auth_providers as $key => $value)
{
- if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
+ if (!($value instanceof phpbb_auth_provider_interface))
{
- $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
+ continue;
}
+ $auth_plugins[] = str_replace('auth.provider.', '', $key);
}
- closedir($dp);
sort($auth_plugins);
diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php
index c7c64ae56b..1a083c20ac 100644
--- a/phpBB/includes/acp/acp_captcha.php
+++ b/phpBB/includes/acp/acp_captcha.php
@@ -124,6 +124,8 @@ class acp_captcha
'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id),
'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(),
'CAPTCHA_SELECT' => $captcha_select,
+
+ 'U_ACTION' => $this->u_action,
));
}
}
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..a1e681b29c 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -575,13 +575,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 004187af84..e830479389 100644
--- a/phpBB/includes/acp/acp_permission_roles.php
+++ b/phpBB/includes/acp/acp_permission_roles.php
@@ -21,6 +21,7 @@ if (!defined('IN_PHPBB'))
class acp_permission_roles
{
var $u_action;
+ protected $auth_admin;
function main($id, $mode)
{
@@ -30,7 +31,7 @@ class acp_permission_roles
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
- $auth_admin = new auth_admin();
+ $this->auth_admin = new auth_admin();
$user->add_lang('acp/permissions');
add_permission_language();
@@ -210,7 +211,7 @@ class acp_permission_roles
}
// Now add the auth settings
- $auth_admin->acl_set_role($role_id, $auth_settings);
+ $this->auth_admin->acl_set_role($role_id, $auth_settings);
$role_name = (!empty($user->lang[$role_name])) ? $user->lang[$role_name] : $role_name;
add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_' . strtoupper($action), $role_name);
@@ -343,7 +344,7 @@ class acp_permission_roles
// Get users/groups/forums using this preset...
if ($action == 'edit')
{
- $hold_ary = $auth_admin->get_role_mask($role_id);
+ $hold_ary = $this->auth_admin->get_role_mask($role_id);
if (sizeof($hold_ary))
{
@@ -354,7 +355,7 @@ class acp_permission_roles
'L_ROLE_ASSIGNED_TO' => sprintf($user->lang['ROLE_ASSIGNED_TO'], $role_name))
);
- $auth_admin->display_role_mask($hold_ary);
+ $this->auth_admin->display_role_mask($hold_ary);
}
}
@@ -445,8 +446,8 @@ class acp_permission_roles
'S_DISPLAY_ROLE_MASK' => true)
);
- $hold_ary = $auth_admin->get_role_mask($display_item);
- $auth_admin->display_role_mask($hold_ary);
+ $hold_ary = $this->auth_admin->get_role_mask($display_item);
+ $this->auth_admin->display_role_mask($hold_ary);
}
}
@@ -462,7 +463,7 @@ class acp_permission_roles
$auth_options = array(0 => $auth_options);
// Making use of auth_admin method here (we do not really want to change two similar code fragments)
- auth_admin::build_permission_array($auth_options, $content_array, $categories, $key_sort_array);
+ $this->auth_admin->build_permission_array($auth_options, $content_array, $categories, $key_sort_array);
$content_array = $content_array[0];
@@ -500,8 +501,6 @@ class acp_permission_roles
{
global $db;
- $auth_admin = new auth_admin();
-
// Get complete auth array
$sql = 'SELECT auth_option, auth_option_id
FROM ' . ACL_OPTIONS_TABLE . "
@@ -529,19 +528,19 @@ class acp_permission_roles
$db->sql_freeresult($result);
// Get role assignments
- $hold_ary = $auth_admin->get_role_mask($role_id);
+ $hold_ary = $this->auth_admin->get_role_mask($role_id);
// Re-assign permissions
foreach ($hold_ary as $forum_id => $forum_ary)
{
if (isset($forum_ary['users']))
{
- $auth_admin->acl_set('user', $forum_id, $forum_ary['users'], $auth_settings, 0, false);
+ $this->auth_admin->acl_set('user', $forum_id, $forum_ary['users'], $auth_settings, 0, false);
}
if (isset($forum_ary['groups']))
{
- $auth_admin->acl_set('group', $forum_id, $forum_ary['groups'], $auth_settings, 0, false);
+ $this->auth_admin->acl_set('group', $forum_id, $forum_ary['groups'], $auth_settings, 0, false);
}
}
@@ -563,6 +562,6 @@ class acp_permission_roles
WHERE role_id = ' . $role_id;
$db->sql_query($sql);
- $auth_admin->acl_clear_prefetch();
+ $this->auth_admin->acl_clear_prefetch();
}
}
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/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php
deleted file mode 100644
index 10b288aa09..0000000000
--- a/phpBB/includes/auth/auth_apache.php
+++ /dev/null
@@ -1,247 +0,0 @@
-<?php
-/**
-* Apache auth plug-in for phpBB3
-*
-* Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
-*
-* @package login
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Checks whether the user is identified to apache
-* Only allow changing authentication to apache if the user is identified
-* Called in acp_board while setting authentication plugins
-*
-* @return boolean|string false if the user is identified and else an error message
-*/
-function init_apache()
-{
- global $user, $request;
-
- if (!$request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $user->data['username'] !== htmlspecialchars_decode($request->server('PHP_AUTH_USER')))
- {
- return $user->lang['APACHE_SETUP_BEFORE_USE'];
- }
- return false;
-}
-
-/**
-* Login function
-*/
-function login_apache(&$username, &$password)
-{
- global $db, $request;
-
- // do not allow empty password
- if (!$password)
- {
- return array(
- 'status' => LOGIN_ERROR_PASSWORD,
- 'error_msg' => 'NO_PASSWORD_SUPPLIED',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- if (!$username)
- {
- return array(
- 'status' => LOGIN_ERROR_USERNAME,
- 'error_msg' => 'LOGIN_ERROR_USERNAME',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- if (!$request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
- {
- return array(
- 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
- 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- $php_auth_user = htmlspecialchars_decode($request->server('PHP_AUTH_USER'));
- $php_auth_pw = htmlspecialchars_decode($request->server('PHP_AUTH_PW'));
-
- if (!empty($php_auth_user) && !empty($php_auth_pw))
- {
- if ($php_auth_user !== $username)
- {
- return array(
- 'status' => LOGIN_ERROR_USERNAME,
- 'error_msg' => 'LOGIN_ERROR_USERNAME',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
- FROM ' . USERS_TABLE . "
- WHERE username = '" . $db->sql_escape($php_auth_user) . "'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if ($row)
- {
- // User inactive...
- if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
- {
- return array(
- 'status' => LOGIN_ERROR_ACTIVE,
- 'error_msg' => 'ACTIVE_ERROR',
- 'user_row' => $row,
- );
- }
-
- // Successful login...
- return array(
- 'status' => LOGIN_SUCCESS,
- 'error_msg' => false,
- 'user_row' => $row,
- );
- }
-
- // this is the user's first login so create an empty profile
- return array(
- 'status' => LOGIN_SUCCESS_CREATE_PROFILE,
- 'error_msg' => false,
- 'user_row' => user_row_apache($php_auth_user, $php_auth_pw),
- );
- }
-
- // Not logged into apache
- return array(
- 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
- 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
-}
-
-/**
-* Autologin function
-*
-* @return array containing the user row or empty if no auto login should take place
-*/
-function autologin_apache()
-{
- global $db, $request;
-
- if (!$request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
- {
- return array();
- }
-
- $php_auth_user = htmlspecialchars_decode($request->server('PHP_AUTH_USER'));
- $php_auth_pw = htmlspecialchars_decode($request->server('PHP_AUTH_PW'));
-
- if (!empty($php_auth_user) && !empty($php_auth_pw))
- {
- set_var($php_auth_user, $php_auth_user, 'string', true);
- set_var($php_auth_pw, $php_auth_pw, 'string', true);
-
- $sql = 'SELECT *
- FROM ' . USERS_TABLE . "
- WHERE username = '" . $db->sql_escape($php_auth_user) . "'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if ($row)
- {
- return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? array() : $row;
- }
-
- if (!function_exists('user_add'))
- {
- global $phpbb_root_path, $phpEx;
-
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
- }
-
- // create the user if he does not exist yet
- user_add(user_row_apache($php_auth_user, $php_auth_pw));
-
- $sql = 'SELECT *
- FROM ' . USERS_TABLE . "
- WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($php_auth_user)) . "'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if ($row)
- {
- return $row;
- }
- }
-
- return array();
-}
-
-/**
-* This function generates an array which can be passed to the user_add function in order to create a user
-*/
-function user_row_apache($username, $password)
-{
- global $db, $config, $user;
- // first retrieve default group id
- $sql = 'SELECT group_id
- FROM ' . GROUPS_TABLE . "
- WHERE group_name = '" . $db->sql_escape('REGISTERED') . "'
- AND group_type = " . GROUP_SPECIAL;
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if (!$row)
- {
- trigger_error('NO_GROUP');
- }
-
- // generate user account data
- return array(
- 'username' => $username,
- 'user_password' => phpbb_hash($password),
- 'user_email' => '',
- 'group_id' => (int) $row['group_id'],
- 'user_type' => USER_NORMAL,
- 'user_ip' => $user->ip,
- 'user_new' => ($config['new_member_post_limit']) ? 1 : 0,
- );
-}
-
-/**
-* The session validation function checks whether the user is still logged in
-*
-* @return boolean true if the given user is authenticated or false if the session should be closed
-*/
-function validate_session_apache(&$user)
-{
- global $request;
-
- // Check if PHP_AUTH_USER is set and handle this case
- if ($request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
- {
- $php_auth_user = $request->server('PHP_AUTH_USER');
-
- return ($php_auth_user === $user['username']) ? true : false;
- }
-
- // PHP_AUTH_USER is not set. A valid session is now determined by the user type (anonymous/bot or not)
- if ($user['user_type'] == USER_IGNORE)
- {
- return true;
- }
-
- return false;
-}
diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php
deleted file mode 100644
index ac944532a5..0000000000
--- a/phpBB/includes/auth/auth_db.php
+++ /dev/null
@@ -1,289 +0,0 @@
-<?php
-/**
-* Database auth plug-in for phpBB3
-*
-* Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
-*
-* This is for authentication via the integrated user table
-*
-* @package login
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Login function
-*
-* @param string $username
-* @param string $password
-* @param string $ip IP address the login is taking place from. Used to
-* limit the number of login attempts per IP address.
-* @param string $browser The user agent used to login
-* @param string $forwarded_for X_FORWARDED_FOR header sent with login request
-* @return array A associative array of the format
-* array(
-* 'status' => status constant
-* 'error_msg' => string
-* 'user_row' => array
-* )
-*/
-function login_db($username, $password, $ip = '', $browser = '', $forwarded_for = '')
-{
- global $db, $config;
- global $request;
-
- // Auth plugins get the password untrimmed.
- // For compatibility we trim() here.
- $password = trim($password);
-
- // do not allow empty password
- if (!$password)
- {
- return array(
- 'status' => LOGIN_ERROR_PASSWORD,
- 'error_msg' => 'NO_PASSWORD_SUPPLIED',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- if (!$username)
- {
- return array(
- 'status' => LOGIN_ERROR_USERNAME,
- 'error_msg' => 'LOGIN_ERROR_USERNAME',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- $username_clean = utf8_clean_string($username);
-
- $sql = 'SELECT user_id, username, user_password, user_passchg, user_pass_convert, user_email, user_type, user_login_attempts
- FROM ' . USERS_TABLE . "
- WHERE username_clean = '" . $db->sql_escape($username_clean) . "'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if (($ip && !$config['ip_login_limit_use_forwarded']) ||
- ($forwarded_for && $config['ip_login_limit_use_forwarded']))
- {
- $sql = 'SELECT COUNT(*) AS attempts
- FROM ' . LOGIN_ATTEMPT_TABLE . '
- WHERE attempt_time > ' . (time() - (int) $config['ip_login_limit_time']);
- if ($config['ip_login_limit_use_forwarded'])
- {
- $sql .= " AND attempt_forwarded_for = '" . $db->sql_escape($forwarded_for) . "'";
- }
- else
- {
- $sql .= " AND attempt_ip = '" . $db->sql_escape($ip) . "' ";
- }
-
- $result = $db->sql_query($sql);
- $attempts = (int) $db->sql_fetchfield('attempts');
- $db->sql_freeresult($result);
-
- $attempt_data = array(
- 'attempt_ip' => $ip,
- 'attempt_browser' => trim(substr($browser, 0, 149)),
- 'attempt_forwarded_for' => $forwarded_for,
- 'attempt_time' => time(),
- 'user_id' => ($row) ? (int) $row['user_id'] : 0,
- 'username' => $username,
- 'username_clean' => $username_clean,
- );
- $sql = 'INSERT INTO ' . LOGIN_ATTEMPT_TABLE . $db->sql_build_array('INSERT', $attempt_data);
- $result = $db->sql_query($sql);
- }
- else
- {
- $attempts = 0;
- }
-
- if (!$row)
- {
- if ($config['ip_login_limit_max'] && $attempts >= $config['ip_login_limit_max'])
- {
- return array(
- 'status' => LOGIN_ERROR_ATTEMPTS,
- 'error_msg' => 'LOGIN_ERROR_ATTEMPTS',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- return array(
- 'status' => LOGIN_ERROR_USERNAME,
- 'error_msg' => 'LOGIN_ERROR_USERNAME',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- $show_captcha = ($config['max_login_attempts'] && $row['user_login_attempts'] >= $config['max_login_attempts']) ||
- ($config['ip_login_limit_max'] && $attempts >= $config['ip_login_limit_max']);
-
- // If there are too much login attempts, we need to check for an confirm image
- // Every auth module is able to define what to do by itself...
- if ($show_captcha)
- {
- // Visual Confirmation handling
- if (!class_exists('phpbb_captcha_factory', false))
- {
- global $phpbb_root_path, $phpEx;
- include ($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
- }
-
- $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
- $captcha->init(CONFIRM_LOGIN);
- $vc_response = $captcha->validate($row);
- if ($vc_response)
- {
- return array(
- 'status' => LOGIN_ERROR_ATTEMPTS,
- 'error_msg' => 'LOGIN_ERROR_ATTEMPTS',
- 'user_row' => $row,
- );
- }
- else
- {
- $captcha->reset();
- }
-
- }
-
- // If the password convert flag is set we need to convert it
- if ($row['user_pass_convert'])
- {
- // enable super globals to get literal value
- // this is needed to prevent unicode normalization
- $super_globals_disabled = $request->super_globals_disabled();
- if ($super_globals_disabled)
- {
- $request->enable_super_globals();
- }
-
- // in phpBB2 passwords were used exactly as they were sent, with addslashes applied
- $password_old_format = isset($_REQUEST['password']) ? (string) $_REQUEST['password'] : '';
- $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format;
- $password_new_format = $request->variable('password', '', true);
-
- if ($super_globals_disabled)
- {
- $request->disable_super_globals();
- }
-
- if ($password == $password_new_format)
- {
- if (!function_exists('utf8_to_cp1252'))
- {
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx);
- }
-
- // cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding
- // plain md5 support left in for conversions from other systems.
- if ((strlen($row['user_password']) == 34 && (phpbb_check_hash(md5($password_old_format), $row['user_password']) || phpbb_check_hash(md5(utf8_to_cp1252($password_old_format)), $row['user_password'])))
- || (strlen($row['user_password']) == 32 && (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password'])))
- {
- $hash = phpbb_hash($password_new_format);
-
- // Update the password in the users table to the new format and remove user_pass_convert flag
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_password = \'' . $db->sql_escape($hash) . '\',
- user_pass_convert = 0
- WHERE user_id = ' . $row['user_id'];
- $db->sql_query($sql);
-
- $row['user_pass_convert'] = 0;
- $row['user_password'] = $hash;
- }
- else
- {
- // Although we weren't able to convert this password we have to
- // increase login attempt count to make sure this cannot be exploited
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_login_attempts = user_login_attempts + 1
- WHERE user_id = ' . (int) $row['user_id'] . '
- AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX;
- $db->sql_query($sql);
-
- return array(
- 'status' => LOGIN_ERROR_PASSWORD_CONVERT,
- 'error_msg' => 'LOGIN_ERROR_PASSWORD_CONVERT',
- 'user_row' => $row,
- );
- }
- }
- }
-
- // Check password ...
- if (!$row['user_pass_convert'] && phpbb_check_hash($password, $row['user_password']))
- {
- // Check for old password hash...
- if (strlen($row['user_password']) == 32)
- {
- $hash = phpbb_hash($password);
-
- // Update the password in the users table to the new format
- $sql = 'UPDATE ' . USERS_TABLE . "
- SET user_password = '" . $db->sql_escape($hash) . "',
- user_pass_convert = 0
- WHERE user_id = {$row['user_id']}";
- $db->sql_query($sql);
-
- $row['user_password'] = $hash;
- }
-
- $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . '
- WHERE user_id = ' . $row['user_id'];
- $db->sql_query($sql);
-
- if ($row['user_login_attempts'] != 0)
- {
- // Successful, reset login attempts (the user passed all stages)
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_login_attempts = 0
- WHERE user_id = ' . $row['user_id'];
- $db->sql_query($sql);
- }
-
- // User inactive...
- if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
- {
- return array(
- 'status' => LOGIN_ERROR_ACTIVE,
- 'error_msg' => 'ACTIVE_ERROR',
- 'user_row' => $row,
- );
- }
-
- // Successful login... set user_login_attempts to zero...
- return array(
- 'status' => LOGIN_SUCCESS,
- 'error_msg' => false,
- 'user_row' => $row,
- );
- }
-
- // Password incorrect - increase login attempts
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_login_attempts = user_login_attempts + 1
- WHERE user_id = ' . (int) $row['user_id'] . '
- AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX;
- $db->sql_query($sql);
-
- // Give status about wrong password...
- return array(
- 'status' => ($show_captcha) ? LOGIN_ERROR_ATTEMPTS : LOGIN_ERROR_PASSWORD,
- 'error_msg' => ($show_captcha) ? 'LOGIN_ERROR_ATTEMPTS' : 'LOGIN_ERROR_PASSWORD',
- 'user_row' => $row,
- );
-}
diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php
deleted file mode 100644
index 98355dd044..0000000000
--- a/phpBB/includes/auth/auth_ldap.php
+++ /dev/null
@@ -1,350 +0,0 @@
-<?php
-/**
-*
-* LDAP auth plug-in for phpBB3
-*
-* Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
-*
-* @package login
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Connect to ldap server
-* Only allow changing authentication to ldap if we can connect to the ldap server
-* Called in acp_board while setting authentication plugins
-*/
-function init_ldap()
-{
- global $config, $user;
-
- if (!@extension_loaded('ldap'))
- {
- return $user->lang['LDAP_NO_LDAP_EXTENSION'];
- }
-
- $config['ldap_port'] = (int) $config['ldap_port'];
- if ($config['ldap_port'])
- {
- $ldap = @ldap_connect($config['ldap_server'], $config['ldap_port']);
- }
- else
- {
- $ldap = @ldap_connect($config['ldap_server']);
- }
-
- if (!$ldap)
- {
- return $user->lang['LDAP_NO_SERVER_CONNECTION'];
- }
-
- @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
- @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
-
- if ($config['ldap_user'] || $config['ldap_password'])
- {
- if (!@ldap_bind($ldap, htmlspecialchars_decode($config['ldap_user']), htmlspecialchars_decode($config['ldap_password'])))
- {
- return $user->lang['LDAP_INCORRECT_USER_PASSWORD'];
- }
- }
-
- // ldap_connect only checks whether the specified server is valid, so the connection might still fail
- $search = @ldap_search(
- $ldap,
- htmlspecialchars_decode($config['ldap_base_dn']),
- ldap_user_filter($user->data['username']),
- (empty($config['ldap_email'])) ?
- array(htmlspecialchars_decode($config['ldap_uid'])) :
- array(htmlspecialchars_decode($config['ldap_uid']), htmlspecialchars_decode($config['ldap_email'])),
- 0,
- 1
- );
-
- if ($search === false)
- {
- return $user->lang['LDAP_SEARCH_FAILED'];
- }
-
- $result = @ldap_get_entries($ldap, $search);
-
- @ldap_close($ldap);
-
-
- if (!is_array($result) || sizeof($result) < 2)
- {
- return sprintf($user->lang['LDAP_NO_IDENTITY'], $user->data['username']);
- }
-
- if (!empty($config['ldap_email']) && !isset($result[0][htmlspecialchars_decode($config['ldap_email'])]))
- {
- return $user->lang['LDAP_NO_EMAIL'];
- }
-
- return false;
-}
-
-/**
-* Login function
-*/
-function login_ldap(&$username, &$password)
-{
- global $db, $config, $user;
-
- // do not allow empty password
- if (!$password)
- {
- return array(
- 'status' => LOGIN_ERROR_PASSWORD,
- 'error_msg' => 'NO_PASSWORD_SUPPLIED',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- if (!$username)
- {
- return array(
- 'status' => LOGIN_ERROR_USERNAME,
- 'error_msg' => 'LOGIN_ERROR_USERNAME',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- if (!@extension_loaded('ldap'))
- {
- return array(
- 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
- 'error_msg' => 'LDAP_NO_LDAP_EXTENSION',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- $config['ldap_port'] = (int) $config['ldap_port'];
- if ($config['ldap_port'])
- {
- $ldap = @ldap_connect($config['ldap_server'], $config['ldap_port']);
- }
- else
- {
- $ldap = @ldap_connect($config['ldap_server']);
- }
-
- if (!$ldap)
- {
- return array(
- 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
- 'error_msg' => 'LDAP_NO_SERVER_CONNECTION',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
-
- @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
- @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
-
- if ($config['ldap_user'] || $config['ldap_password'])
- {
- if (!@ldap_bind($ldap, htmlspecialchars_decode($config['ldap_user']), htmlspecialchars_decode($config['ldap_password'])))
- {
- return array(
- 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
- 'error_msg' => 'LDAP_NO_SERVER_CONNECTION',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
- }
-
- $search = @ldap_search(
- $ldap,
- htmlspecialchars_decode($config['ldap_base_dn']),
- ldap_user_filter($username),
- (empty($config['ldap_email'])) ?
- array(htmlspecialchars_decode($config['ldap_uid'])) :
- array(htmlspecialchars_decode($config['ldap_uid']), htmlspecialchars_decode($config['ldap_email'])),
- 0,
- 1
- );
-
- $ldap_result = @ldap_get_entries($ldap, $search);
-
- if (is_array($ldap_result) && sizeof($ldap_result) > 1)
- {
- if (@ldap_bind($ldap, $ldap_result[0]['dn'], htmlspecialchars_decode($password)))
- {
- @ldap_close($ldap);
-
- $sql ='SELECT user_id, username, user_password, user_passchg, user_email, user_type
- FROM ' . USERS_TABLE . "
- WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if ($row)
- {
- unset($ldap_result);
-
- // User inactive...
- if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
- {
- return array(
- 'status' => LOGIN_ERROR_ACTIVE,
- 'error_msg' => 'ACTIVE_ERROR',
- 'user_row' => $row,
- );
- }
-
- // Successful login... set user_login_attempts to zero...
- return array(
- 'status' => LOGIN_SUCCESS,
- 'error_msg' => false,
- 'user_row' => $row,
- );
- }
- else
- {
- // retrieve default group id
- $sql = 'SELECT group_id
- FROM ' . GROUPS_TABLE . "
- WHERE group_name = '" . $db->sql_escape('REGISTERED') . "'
- AND group_type = " . GROUP_SPECIAL;
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if (!$row)
- {
- trigger_error('NO_GROUP');
- }
-
- // generate user account data
- $ldap_user_row = array(
- 'username' => $username,
- 'user_password' => phpbb_hash($password),
- 'user_email' => (!empty($config['ldap_email'])) ? utf8_htmlspecialchars($ldap_result[0][htmlspecialchars_decode($config['ldap_email'])][0]) : '',
- 'group_id' => (int) $row['group_id'],
- 'user_type' => USER_NORMAL,
- 'user_ip' => $user->ip,
- 'user_new' => ($config['new_member_post_limit']) ? 1 : 0,
- );
-
- unset($ldap_result);
-
- // this is the user's first login so create an empty profile
- return array(
- 'status' => LOGIN_SUCCESS_CREATE_PROFILE,
- 'error_msg' => false,
- 'user_row' => $ldap_user_row,
- );
- }
- }
- else
- {
- unset($ldap_result);
- @ldap_close($ldap);
-
- // Give status about wrong password...
- return array(
- 'status' => LOGIN_ERROR_PASSWORD,
- 'error_msg' => 'LOGIN_ERROR_PASSWORD',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
- }
-
- @ldap_close($ldap);
-
- return array(
- 'status' => LOGIN_ERROR_USERNAME,
- 'error_msg' => 'LOGIN_ERROR_USERNAME',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
-}
-
-/**
-* Generates a filter string for ldap_search to find a user
-*
-* @param $username string Username identifying the searched user
-*
-* @return string A filter string for ldap_search
-*/
-function ldap_user_filter($username)
-{
- global $config;
-
- $filter = '(' . $config['ldap_uid'] . '=' . ldap_escape(htmlspecialchars_decode($username)) . ')';
- if ($config['ldap_user_filter'])
- {
- $_filter = ($config['ldap_user_filter'][0] == '(' && substr($config['ldap_user_filter'], -1) == ')') ? $config['ldap_user_filter'] : "({$config['ldap_user_filter']})";
- $filter = "(&{$filter}{$_filter})";
- }
- return $filter;
-}
-
-/**
-* Escapes an LDAP AttributeValue
-*/
-function ldap_escape($string)
-{
- return str_replace(array('*', '\\', '(', ')'), array('\\*', '\\\\', '\\(', '\\)'), $string);
-}
-
-/**
-* This function is used to output any required fields in the authentication
-* admin panel. It also defines any required configuration table fields.
-*/
-function acp_ldap(&$new)
-{
- global $user;
-
- $tpl = '
-
- <dl>
- <dt><label for="ldap_server">' . $user->lang['LDAP_SERVER'] . $user->lang['COLON'] . '</label><br /><span>' . $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">' . $user->lang['LDAP_PORT'] . $user->lang['COLON'] . '</label><br /><span>' . $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">' . $user->lang['LDAP_DN'] . $user->lang['COLON'] . '</label><br /><span>' . $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">' . $user->lang['LDAP_UID'] . $user->lang['COLON'] . '</label><br /><span>' . $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">' . $user->lang['LDAP_USER_FILTER'] . $user->lang['COLON'] . '</label><br /><span>' . $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">' . $user->lang['LDAP_EMAIL'] . $user->lang['COLON'] . '</label><br /><span>' . $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">' . $user->lang['LDAP_USER'] . $user->lang['COLON'] . '</label><br /><span>' . $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">' . $user->lang['LDAP_PASSWORD'] . $user->lang['COLON'] . '</label><br /><span>' . $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')
- );
-}
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index c198abeb54..fd00728510 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -134,11 +134,11 @@ class bbcode
$style_resource_locator = new phpbb_style_resource_locator();
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path);
- $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager);
+ $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager);
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template);
$style->set_style();
$template->set_filenames(array('bbcode.html' => 'bbcode.html'));
- $this->template_filename = $style_resource_locator->get_source_file_for_handle('bbcode.html');
+ $this->template_filename = $template->get_source_file_for_handle('bbcode.html');
}
$bbcode_ids = $rowset = $sql = array();
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 8c27d3fd0c..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);
@@ -156,6 +160,7 @@ define('PHYSICAL_LINK', 2);
define('CONFIRM_REG', 1);
define('CONFIRM_LOGIN', 2);
define('CONFIRM_POST', 3);
+define('CONFIRM_REPORT', 4);
// Categories - Attachments
define('ATTACHMENT_CATEGORY_NONE', 0);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index b087e1298b..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];
@@ -2345,9 +2345,8 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam
$tpl_prefix . 'BASE_URL' => $base_url,
'A_' . $tpl_prefix . 'BASE_URL' => addslashes($base_url),
$tpl_prefix . 'PER_PAGE' => $per_page,
- $tpl_prefix . 'PREVIOUS_PAGE' => $previous_page,
- $tpl_prefix . 'PREV_PAGE' => $previous_page,
- $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page) : '',
+ 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => $previous_page,
+ 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page) : '',
$tpl_prefix . 'TOTAL_PAGES' => $total_pages,
$tpl_prefix . 'CURRENT_PAGE' => $on_page,
);
@@ -3302,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 72855af5f8..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)
{
@@ -2899,7 +2933,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
if ($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout))
{
- @fputs($fsock, "GET $directory/$filename HTTP/1.1\r\n");
+ @fputs($fsock, "GET $directory/$filename HTTP/1.0\r\n");
@fputs($fsock, "HOST: $host\r\n");
@fputs($fsock, "Connection: close\r\n\r\n");
diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php
index e22fa9919a..5c6bd6dd8a 100644
--- a/phpBB/includes/functions_container.php
+++ b/phpBB/includes/functions_container.php
@@ -21,6 +21,71 @@ if (!defined('IN_PHPBB'))
}
/**
+* Get DB connection from config.php.
+*
+* Used to bootstrap the container.
+*
+* @param string $config_file
+* @return phpbb_db_driver
+*/
+function phpbb_bootstrap_db_connection($config_file)
+{
+ require($config_file);
+ $dbal_driver_class = phpbb_convert_30_dbms_to_31($dbms);
+
+ $db = new $dbal_driver_class();
+ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, defined('PHPBB_DB_NEW_LINK'));
+
+ return $db;
+}
+
+/**
+* Get table prefix from config.php.
+*
+* Used to bootstrap the container.
+*
+* @param string $config_file
+* @return string table prefix
+*/
+function phpbb_bootstrap_table_prefix($config_file)
+{
+ require($config_file);
+ return $table_prefix;
+}
+
+/**
+* Get enabled extensions.
+*
+* Used to bootstrap the container.
+*
+* @param string $config_file
+* @param string $phpbb_root_path
+* @return array enabled extensions
+*/
+function phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path)
+{
+ $db = phpbb_bootstrap_db_connection($config_file);
+ $table_prefix = phpbb_bootstrap_table_prefix($config_file);
+ $extension_table = $table_prefix.'ext';
+
+ $sql = 'SELECT *
+ FROM ' . $extension_table . '
+ WHERE ext_active = 1';
+
+ $result = $db->sql_query($sql);
+ $rows = $db->sql_fetchrowset($result);
+ $db->sql_freeresult($result);
+
+ $exts = array();
+ foreach ($rows as $row)
+ {
+ $exts[$row['ext_name']] = $phpbb_root_path . 'ext/' . $row['ext_name'] . '/';
+ }
+
+ return $exts;
+}
+
+/**
* Create the ContainerBuilder object
*
* @param array $extensions Array of Container extension objects
@@ -106,16 +171,9 @@ function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path)
* @param string $php_ext PHP Extension
* @return ContainerBuilder object (compiled)
*/
-function phpbb_create_compiled_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
+function phpbb_create_compiled_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
{
- // Create a temporary container for access to the ext.manager service
- $tmp_container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext);
- $tmp_container->compile();
-
- // XXX stop writing to global $cache when
- // http://tracker.phpbb.com/browse/PHPBB3-11203 is fixed
- $GLOBALS['cache'] = $tmp_container->get('cache');
- $installed_exts = $tmp_container->get('ext.manager')->all_enabled();
+ $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path);
// Now pass the enabled extension paths into the ext compiler extension
$extensions[] = new phpbb_di_extension_ext($installed_exts);
@@ -142,7 +200,7 @@ function phpbb_create_compiled_container(array $extensions, array $passes, $phpb
* @param string $php_ext PHP Extension
* @return ContainerBuilder object (compiled)
*/
-function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
+function phpbb_create_dumped_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
{
// Check for our cached container; if it exists, use it
$container_filename = phpbb_container_filename($phpbb_root_path, $php_ext);
@@ -152,7 +210,7 @@ function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_
return new phpbb_cache_container();
}
- $container = phpbb_create_compiled_container($extensions, $passes, $phpbb_root_path, $php_ext);
+ $container = phpbb_create_compiled_container($config_file, $extensions, $passes, $phpbb_root_path, $php_ext);
// Lastly, we create our cached container class
$dumper = new PhpDumper($container);
@@ -182,10 +240,10 @@ function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_
* @param string $php_ext PHP Extension
* @return ContainerBuilder object (compiled)
*/
-function phpbb_create_dumped_container_unless_debug(array $extensions, array $passes, $phpbb_root_path, $php_ext)
+function phpbb_create_dumped_container_unless_debug($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext)
{
$container_factory = defined('DEBUG') ? 'phpbb_create_compiled_container' : 'phpbb_create_dumped_container';
- return $container_factory($extensions, $passes, $phpbb_root_path, $php_ext);
+ return $container_factory($config_file, $extensions, $passes, $phpbb_root_path, $php_ext);
}
/**
@@ -199,9 +257,11 @@ function phpbb_create_dumped_container_unless_debug(array $extensions, array $pa
*/
function phpbb_create_default_container($phpbb_root_path, $php_ext)
{
+ $config_file = $phpbb_root_path . 'config.' . $php_ext;
return phpbb_create_dumped_container_unless_debug(
+ $config_file,
array(
- new phpbb_di_extension_config($phpbb_root_path . 'config.' . $php_ext),
+ new phpbb_di_extension_config($config_file),
new phpbb_di_extension_core($phpbb_root_path . 'config'),
),
array(
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_jabber.php b/phpBB/includes/functions_jabber.php
index 3d8e403f4b..b260ffad6e 100644
--- a/phpBB/includes/functions_jabber.php
+++ b/phpBB/includes/functions_jabber.php
@@ -249,7 +249,7 @@ class jabber
return true;
}
- // Apparently an error occured...
+ // Apparently an error occurred...
$this->add_to_log('Error: open_socket() - ' . $errorstr);
return false;
}
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index a646f35fdd..0222a57bcc 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -27,8 +27,9 @@ class messenger
var $mail_priority = MAIL_NORMAL_PRIORITY;
var $use_queue = true;
- var $tpl_obj = NULL;
- var $tpl_msg = array();
+ /** @var phpbb_template */
+ protected $template;
+
var $eol = "\n";
/**
@@ -55,10 +56,10 @@ class messenger
$this->vars = $this->msg = $this->replyto = $this->from = '';
$this->mail_priority = MAIL_NORMAL_PRIORITY;
}
-
+
/**
* Set addresses for to/im as available
- *
+ *
* @param array $user User row
*/
function set_addresses($user)
@@ -210,6 +211,8 @@ class messenger
{
global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager;
+ $this->setup_template();
+
if (!trim($template_file))
{
trigger_error('No template file for emailing set.', E_USER_ERROR);
@@ -219,46 +222,43 @@ class messenger
{
// fall back to board default language if the user's language is
// missing $template_file. If this does not exist either,
- // $tpl->set_filenames will do a trigger_error
+ // $this->template->set_filenames will do a trigger_error
$template_lang = basename($config['default_lang']);
}
- // tpl_msg now holds a template object we can use to parse the template file
- if (!isset($this->tpl_msg[$template_lang . $template_file]))
+ if ($template_path)
{
- $style_resource_locator = new phpbb_style_resource_locator();
- $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path);
- $tpl = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager);
- $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl);
-
- $this->tpl_msg[$template_lang . $template_file] = $tpl;
+ $template_paths = array(
+ $template_path,
+ );
+ }
+ else
+ {
+ $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/';
+ $template_path .= $template_lang . '/email';
- $fallback_template_path = false;
+ $template_paths = array(
+ $template_path,
+ );
- if (!$template_path)
+ // we can only specify default language fallback when the path is not a custom one for which we
+ // do not know the default language alternative
+ if ($template_lang !== basename($config['default_lang']))
{
- $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/';
- $template_path .= $template_lang . '/email';
+ $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/';
+ $fallback_template_path .= basename($config['default_lang']) . '/email';
- // we can only specify default language fallback when the path is not a custom one for which we
- // do not know the default language alternative
- if ($template_lang !== basename($config['default_lang']))
- {
- $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/';
- $fallback_template_path .= basename($config['default_lang']) . '/email';
- }
+ $template_paths[] = $fallback_template_path;
}
+ }
- $style->set_custom_style($template_lang . '_email', array($template_path, $fallback_template_path), array(), '');
+ $this->set_template_paths($template_lang . '_email', $template_paths);
- $tpl->set_filenames(array(
- 'body' => $template_file . '.txt',
- ));
- }
+ $this->template->set_filenames(array(
+ 'body' => $template_file . '.txt',
+ ));
- $this->tpl_obj = &$this->tpl_msg[$template_lang . $template_file];
- $this->vars = &$this->tpl_obj->_rootref;
- $this->tpl_msg = '';
+ $this->vars = $this->template->get_template_vars();
return true;
}
@@ -268,22 +268,16 @@ class messenger
*/
function assign_vars($vars)
{
- if (!is_object($this->tpl_obj))
- {
- return;
- }
+ $this->setup_template();
- $this->tpl_obj->assign_vars($vars);
+ $this->template->assign_vars($vars);
}
function assign_block_vars($blockname, $vars)
{
- if (!is_object($this->tpl_obj))
- {
- return;
- }
+ $this->setup_template();
- $this->tpl_obj->assign_block_vars($blockname, $vars);
+ $this->template->assign_block_vars($blockname, $vars);
}
/**
@@ -316,7 +310,7 @@ class messenger
}
// Parse message through template
- $this->msg = trim($this->tpl_obj->assign_display('body'));
+ $this->msg = trim($this->template->assign_display('body'));
// Because we use \n for newlines in the body message we need to fix line encoding errors for those admins who uploaded email template files in the wrong encoding
$this->msg = str_replace("\r\n", "\n", $this->msg);
@@ -643,6 +637,31 @@ class messenger
unset($addresses);
return true;
}
+
+ /**
+ * Setup template engine
+ */
+ protected function setup_template()
+ {
+ global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager;
+
+ if ($this->template instanceof phpbb_template)
+ {
+ return;
+ }
+
+ $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager);
+ }
+
+ /**
+ * Set template paths to load
+ */
+ protected function set_template_paths($path_name, $paths)
+ {
+ $this->setup_template();
+
+ $this->template->set_style_names(array($path_name), $paths);
+ }
}
/**
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 0d387ace6d..99c24fcb19 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -455,7 +455,7 @@ class p_master
*/
function load_active($mode = false, $module_url = false, $execute_module = true)
{
- global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user;
+ global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $phpbb_style;
$module_path = $this->include_path . $this->p_class;
$icat = request_var('icat', '');
@@ -494,6 +494,24 @@ class p_master
// We pre-define the action parameter we are using all over the place
if (defined('IN_ADMIN'))
{
+ /*
+ * If this is an extension module, we'll try to automatically set
+ * the style paths for the extension (the ext author can change them
+ * if necessary).
+ */
+ $module_dir = explode('_', get_class($this->module));
+
+ // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ...
+ if (isset($module_dir[3]) && $module_dir[1] === 'ext')
+ {
+ $module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/adm/style';
+
+ if (is_dir($module_style_dir))
+ {
+ $phpbb_style->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), array(), '');
+ }
+ }
+
// Is first module automatically enabled a duplicate and the category not passed yet?
if (!$icat && $this->module_ary[$this->active_module_row_id]['is_duplicate'])
{
@@ -505,6 +523,24 @@ class p_master
}
else
{
+ /*
+ * If this is an extension module, we'll try to automatically set
+ * the style paths for the extension (the ext author can change them
+ * if necessary).
+ */
+ $module_dir = explode('_', get_class($this->module));
+
+ // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ...
+ if (isset($module_dir[3]) && $module_dir[1] === 'ext')
+ {
+ $module_style_dir = 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/styles';
+
+ if (is_dir($phpbb_root_path . $module_style_dir))
+ {
+ $phpbb_style->set_style(array($module_style_dir, 'styles'));
+ }
+ }
+
// If user specified the module url we will use it...
if ($module_url !== false)
{
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index b9b518ad32..03565c27bb 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,21 @@ 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'])
+ // 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' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
{
- // 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 +2019,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 +2179,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 +2212,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
break;
}
}
- else
+ else if ($post_visibility == ITEM_UNAPPROVED)
{
switch ($mode)
{
@@ -2276,6 +2229,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 +2268,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/template/compile.php b/phpBB/includes/template/compile.php
deleted file mode 100644
index 76cb3011df..0000000000
--- a/phpBB/includes/template/compile.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-stream_filter_register('phpbb_template', 'phpbb_template_filter');
-
-/**
-* Extension of template class - Functions needed for compiling templates only.
-*
-* @package phpBB3
-* @uses template_filter As a PHP stream filter to perform compilation of templates
-*/
-class phpbb_template_compile
-{
- /**
- * Array of parameters to forward to template filter
- *
- * @var array
- */
- private $filter_params;
-
- /**
- * Array of default parameters
- *
- * @var array
- */
- private $default_filter_params;
-
- /**
- * Constructor.
- *
- * @param bool $allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
- * @param array $style_names Name of style to which the template being compiled belongs and parents in style tree order
- * @param phpbb_style_resource_locator $locator Resource locator
- * @param string $phpbb_root_path Path to phpBB root directory
- * @param phpbb_extension_manager $extension_manager Extension manager to use for finding template fragments in extensions; if null, template events will not be invoked
- * @param phpbb_user $user Current user
- */
- public function __construct($allow_php, $style_names, $locator, $phpbb_root_path, $extension_manager = null, $user = null)
- {
- $this->filter_params = $this->default_filter_params = array(
- 'allow_php' => $allow_php,
- 'style_names' => $style_names,
- 'locator' => $locator,
- 'phpbb_root_path' => $phpbb_root_path,
- 'extension_manager' => $extension_manager,
- 'user' => $user,
- 'template_compile' => $this,
- 'cleanup' => true,
- );
- }
-
- /**
- * Set filter parameters
- *
- * @param array $params Array of parameters (will be merged onto $this->filter_params)
- */
- public function set_filter_params($params)
- {
- $this->filter_params = array_merge(
- $this->filter_params,
- $params
- );
- }
-
- /**
- * Reset filter parameters to their default settings
- */
- public function reset_filter_params()
- {
- $this->filter_params = $this->default_filter_params;
- }
-
- /**
- * Compiles template in $source_file and writes compiled template to
- * cache directory
- *
- * @param string $handle Template handle to compile
- * @param string $source_file Source template file
- * @return bool Return true on success otherwise false
- */
- public function compile_file_to_file($source_file, $compiled_file)
- {
- $lock = new phpbb_lock_flock($compiled_file);
- $lock->acquire();
-
- $source_handle = @fopen($source_file, 'rb');
- $destination_handle = @fopen($compiled_file, 'wb');
-
- if (!$source_handle || !$destination_handle)
- {
- return false;
- }
-
- $this->compile_stream_to_stream($source_handle, $destination_handle);
-
- @fclose($source_handle);
- @fclose($destination_handle);
-
- phpbb_chmod($compiled_file, CHMOD_READ | CHMOD_WRITE);
-
- $lock->release();
-
- clearstatcache();
-
- return true;
- }
-
- /**
- * Compiles a template located at $source_file.
- *
- * Returns PHP source suitable for eval().
- *
- * @param string $source_file Source template file
- * @return string|bool Return compiled code on successful compilation otherwise false
- */
- public function compile_file($source_file)
- {
- $source_handle = @fopen($source_file, 'rb');
- $destination_handle = @fopen('php://temp' ,'r+b');
-
- if (!$source_handle || !$destination_handle)
- {
- return false;
- }
-
- $this->compile_stream_to_stream($source_handle, $destination_handle);
-
- @fclose($source_handle);
-
- rewind($destination_handle);
- $contents = stream_get_contents($destination_handle);
- @fclose($dest_handle);
-
- return $contents;
- }
-
- /**
- * Compiles contents of $source_stream into $dest_stream.
- *
- * A stream filter is appended to $source_stream as part of the
- * process.
- *
- * @param resource $source_stream Source stream
- * @param resource $dest_stream Destination stream
- * @return null
- */
- private function compile_stream_to_stream($source_stream, $dest_stream)
- {
- stream_filter_append($source_stream, 'phpbb_template', null, $this->filter_params);
- stream_copy_to_stream($source_stream, $dest_stream);
- }
-}
diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php
deleted file mode 100644
index f2bd442010..0000000000
--- a/phpBB/includes/template/filter.php
+++ /dev/null
@@ -1,1260 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2011 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* The template filter that does the actual compilation
-*
-* psoTFX, phpBB Development Team - Completion of file caching, decompilation
-* routines and implementation of conditionals/keywords and associated changes
-*
-* The interface was inspired by PHPLib templates, and the template file (formats are
-* quite similar)
-*
-* The keyword/conditional implementation is currently based on sections of code from
-* the Smarty templating engine (c) 2001 ispi of Lincoln, Inc. which is released
-* (on its own and in whole) under the LGPL. Section 3 of the LGPL states that any code
-* derived from an LGPL application may be relicenced under the GPL, this applies
-* to this source
-*
-* DEFINE directive inspired by a request by Cyberalien
-*
-* @see template_compile
-* @package phpBB3
-*/
-class phpbb_template_filter extends php_user_filter
-{
- const REGEX_NS = '[a-z_][a-z_0-9]+';
-
- const REGEX_VAR = '[A-Z_][A-Z_0-9]+';
- const REGEX_VAR_SUFFIX = '[A-Z_0-9]+';
-
- const REGEX_TAG = '<!-- ([A-Z][A-Z_0-9]+)(?: (.*?) ?)?-->';
-
- const REGEX_TOKENS = '~<!-- ([A-Z][A-Z_0-9]+)(?: (.*?) ?)?-->|{((?:[a-z_][a-z_0-9]+\.)*\\$?[A-Z][A-Z_0-9]+)}~';
-
- /**
- * @var array
- */
- private $block_names = array();
-
- /**
- * @var array
- */
- private $block_else_level = array();
-
- /**
- * @var string
- */
- private $chunk;
-
- /**
- * @var bool
- */
- private $in_php;
-
- /**
- * Whether inline PHP code, <!-- PHP --> and <!-- INCLUDEPHP --> tags
- * are allowed. If this is false all PHP code will be silently
- * removed from the template during compilation.
- *
- * @var bool
- */
- private $allow_php;
-
- /**
- * Whether cleanup will be performed on resulting code, see compile()
- * (Preserve whitespace)
- *
- * @var bool
- */
- private $cleanup = true;
-
- /**
- * Resource locator.
- *
- * @var phpbb_template_locator
- */
- private $locator;
-
- /**
- * @var string phpBB root path
- */
- private $phpbb_root_path;
-
- /**
- * Name of the style that the template being compiled and/or rendered
- * belongs to, and its parents, in inheritance tree order.
- *
- * Used to invoke style-specific template events.
- *
- * @var array
- */
- private $style_names;
-
- /**
- * Extension manager.
- *
- * @var phpbb_extension_manager
- */
- private $extension_manager;
-
- /**
- * Current user
- *
- * @var phpbb_user
- */
- private $user;
-
- /**
- * Template compiler.
- *
- * @var phpbb_template_compile
- */
- private $template_compile;
-
- /**
- * Stream filter
- *
- * Is invoked for evey chunk of the stream, allowing us
- * to work on a chunk at a time, which saves memory.
- */
- public function filter($in, $out, &$consumed, $closing)
- {
- $written = false;
- $first = false;
-
- while ($bucket = stream_bucket_make_writeable($in))
- {
- $consumed += $bucket->datalen;
-
- $data = $this->chunk . $bucket->data;
- $last_nl = strrpos($data, "\n");
- $this->chunk = substr($data, $last_nl);
- $data = substr($data, 0, $last_nl);
-
- if (!strlen($data))
- {
- continue;
- }
-
- $written = true;
-
- $data = $this->compile($data);
- if (!$first)
- {
- $data = $this->prepend_preamble($data);
- $first = false;
- }
- $bucket->data = $data;
- $bucket->datalen = strlen($bucket->data);
- stream_bucket_append($out, $bucket);
- }
-
- if ($closing && strlen($this->chunk))
- {
- $written = true;
- $bucket = stream_bucket_new($this->stream, $this->compile($this->chunk));
- stream_bucket_append($out, $bucket);
- }
-
- return $written ? PSFS_PASS_ON : PSFS_FEED_ME;
- }
-
- /**
- * Initializer, called on creation.
- *
- * Get the allow_php option, style_names, root directory and locator from params,
- * which are passed to stream_filter_append.
- *
- * @return boolean Returns true
- */
- public function onCreate()
- {
- $this->chunk = '';
- $this->in_php = false;
- $this->allow_php = $this->params['allow_php'];
- $this->locator = $this->params['locator'];
- $this->phpbb_root_path = $this->params['phpbb_root_path'];
- $this->style_names = $this->params['style_names'];
- $this->extension_manager = $this->params['extension_manager'];
- $this->cleanup = $this->params['cleanup'];
- if (isset($this->params['user']))
- {
- $this->user = $this->params['user'];
- }
- $this->template_compile = $this->params['template_compile'];
- return true;
- }
-
- /**
- * Compiles a chunk of template.
- *
- * The chunk must comprise of one or more complete lines from the source
- * template.
- *
- * @param string $data Chunk of source template to compile
- * @return string Compiled PHP/HTML code
- */
- private function compile($data)
- {
- $block_start_in_php = $this->in_php;
-
- $data = preg_replace('#<(?:[\\?%]|script)#s', '<?php echo\'\\0\';?>', $data);
- $data = preg_replace_callback(self::REGEX_TOKENS, array($this, 'replace'), $data);
-
- // Remove php
- if (!$this->allow_php)
- {
- if ($block_start_in_php
- && $this->in_php
- && strpos($data, '<!-- PHP -->') === false
- && strpos($data, '<!-- ENDPHP -->') === false)
- {
- // This is just php code
- return '';
- }
- $data = preg_replace('~^.*?<!-- ENDPHP -->~', '', $data);
- $data = preg_replace('~<!-- PHP -->.*?<!-- ENDPHP -->~', '', $data);
- $data = preg_replace('~<!-- ENDPHP -->.*?$~', '', $data);
- }
-
- if ($this->cleanup)
- {
- /*
-
- Preserve whitespace.
- PHP removes a newline after the closing tag (if it's there).
- This is by design:
-
- http://www.php.net/manual/en/language.basic-syntax.phpmode.php
- http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php
-
-
- Consider the following template:
-
- <!-- IF condition -->
- some content
- <!-- ENDIF -->
-
- If we were to simply preserve all whitespace, we could simply
- replace all "?>" tags with "?>\n".
- Doing that, would add additional newlines to the compiled
- template in place of the IF and ENDIF statements. These
- newlines are unwanted (and one is conditional). The IF and
- ENDIF are usually on their own line for ease of reading.
-
- This replacement preserves newlines only for statements that
- are not the only statement on a line. It will NOT preserve
- newlines at the end of statements in the above example.
- It will preserve newlines in situations like:
-
- <!-- IF condition -->inline content<!-- ENDIF -->
-
- */
-
- $data = preg_replace('~(?<!^)(<\?php.+(?<!/\*\*/)\?>)$~m', "$1\n", $data);
- $data = str_replace('/**/?>', "?>\n", $data);
- $data = str_replace('?><?php', '', $data);
- }
-
- return $data;
- }
-
- /**
- * Prepends a preamble to compiled template.
- * Currently preamble checks if IN_PHPBB is defined and calls exit() if it is not.
- *
- * @param string $data Compiled template chunk
- * @return string Compiled template chunk with preamble prepended
- */
- private function prepend_preamble($data)
- {
- $data = "<?php if (!defined('IN_PHPBB')) exit;" . ((strncmp($data, '<?php', 5) === 0) ? substr($data, 5) : ' ?>' . $data);
- return $data;
- }
-
- /**
- * Callback for replacing matched tokens with compiled template code.
- *
- * Compiled template code is an HTML stream with embedded PHP.
- *
- * @param array $matches Regular expression matches
- * @return string compiled template code
- */
- private function replace($matches)
- {
- if ($this->in_php && $matches[1] != 'ENDPHP')
- {
- return '';
- }
-
- if (isset($matches[3]))
- {
- return $this->compile_var_tags($matches[0]);
- }
-
- switch ($matches[1])
- {
- case 'BEGIN':
- $this->block_else_level[] = false;
- return '<?php ' . $this->compile_tag_block($matches[2]) . ' ?>';
- break;
-
- case 'BEGINELSE':
- $this->block_else_level[sizeof($this->block_else_level) - 1] = true;
- return '<?php }} else { ?>';
- break;
-
- case 'END':
- array_pop($this->block_names);
- return '<?php ' . ((array_pop($this->block_else_level)) ? '}' : '}}') . ' ?>';
- break;
-
- case 'IF':
- return '<?php ' . $this->compile_tag_if($matches[2], false) . ' ?>';
- break;
-
- case 'ELSE':
- return '<?php } else { ?>';
- break;
-
- case 'ELSEIF':
- return '<?php ' . $this->compile_tag_if($matches[2], true) . ' ?>';
- break;
-
- case 'ENDIF':
- return '<?php } ?>';
- break;
-
- case 'DEFINE':
- return '<?php ' . $this->compile_tag_define($matches[2], true) . ' ?>';
- break;
-
- case 'UNDEFINE':
- return '<?php ' . $this->compile_tag_define($matches[2], false) . ' ?>';
- break;
-
- case 'ENDDEFINE':
- return '<?php ' . $this->compile_tag_enddefine() . ' ?>';
- break;
-
- case 'INCLUDE':
- return '<?php ' . $this->compile_tag_include($matches[2]) . ' ?>';
- break;
-
- case 'INCLUDEPHP':
- return ($this->allow_php) ? '<?php ' . $this->compile_tag_include_php($matches[2]) . ' ?>' : '';
- break;
-
- case 'INCLUDEJS':
- return '<?php ' . $this->compile_tag_include_js($matches[2]) . ' ?>';
- break;
-
- case 'PHP':
- if ($this->allow_php)
- {
- $this->in_php = true;
- return '<?php ';
- }
- return '<!-- PHP -->';
- break;
-
- case 'ENDPHP':
- if ($this->allow_php)
- {
- $this->in_php = false;
- return ' ?>';
- }
- return '<!-- ENDPHP -->';
- break;
-
- case 'EVENT':
- return '<?php ' . $this->compile_tag_event($matches[2]) . '?>';
- break;
-
- default:
- return $matches[0];
- break;
-
- }
- return '';
- }
-
- /**
- * Convert template variables into PHP varrefs
- *
- * @param string $text_blocks Variable reference in source template
- * @param bool $is_expr Returns whether the source was an expression type variable (i.e. S_FIRST_ROW)
- * @return string PHP variable name
- */
- private function get_varref($text_blocks, &$is_expr)
- {
- // change template varrefs into PHP varrefs
- $varrefs = array();
-
- // This one will handle varrefs WITH namespaces
- preg_match_all('#\{((?:' . self::REGEX_NS . '\.)+)(\$)?(' . self::REGEX_VAR . ')\}#', $text_blocks, $varrefs, PREG_SET_ORDER);
-
- foreach ($varrefs as $var_val)
- {
- $namespace = $var_val[1];
- $varname = $var_val[3];
- $new = $this->generate_block_varref($namespace, $varname, $is_expr, $var_val[2]);
-
- $text_blocks = str_replace($var_val[0], $new, $text_blocks);
- }
-
- // Language variables cannot be reduced to a single varref, so they must be skipped
- // These two replacements would break language variables, so we can only run them on non-language types
- if (strpos($text_blocks, '{L_') === false && strpos($text_blocks, '{LA_') === false)
- {
- // This will handle the remaining root-level varrefs
- $text_blocks = preg_replace('#\{(' . self::REGEX_VAR . ')\}#', "\$_rootref['\\1']", $text_blocks);
- $text_blocks = preg_replace('#\{\$(' . self::REGEX_VAR . ')\}#', "\$_tpldata['DEFINE']['.']['\\1']", $text_blocks);
- }
-
- return $text_blocks;
- }
-
- /**
- * Parse paths of the form {FOO}/a/{BAR}/b
- *
- * Note: this method assumes at least one variable in the path, this should
- * be checked before this method is called.
- *
- * @param string $path The path to parse
- * @param string $include_type The type of template function to call
- * @return string An appropriately formatted string to include in the
- * template or an empty string if an expression like S_FIRST_ROW was
- * incorrectly used
- */
- private function parse_dynamic_path($path, $include_type)
- {
- $matches = array();
- $replace = array();
- $is_expr = true;
-
- preg_match_all('#\{((?:' . self::REGEX_NS . '\.)*)(\$)?(' . self::REGEX_VAR . ')\}#', $path, $matches);
- foreach ($matches[0] as $var_str)
- {
- $tmp_is_expr = false;
- $var = $this->get_varref($var_str, $tmp_is_expr);
- $is_expr = $is_expr && $tmp_is_expr;
- $replace[] = "' . $var . '";
- }
-
- if (!$is_expr)
- {
- return " \$_template->$include_type('" . str_replace($matches[0], $replace, $path) . "', true);";
- }
- else
- {
- return '';
- }
- }
-
- /**
- * Compile variables
- *
- * @param string $text_blocks Variable reference in source template
- * @return string compiled template code
- */
- private function compile_var_tags(&$text_blocks)
- {
- $text_blocks = $this->get_varref($text_blocks, $is_expr);
- $lang_replaced = $this->compile_language_tags($text_blocks);
-
- if(!$lang_replaced)
- {
- $text_blocks = '<?php echo ' . ($is_expr ? "$text_blocks" : "(isset($text_blocks)) ? $text_blocks : ''") . '; /**/?>';
- }
-
- return $text_blocks;
- }
-
- /**
- * Handles special language tags L_ and LA_
- *
- * @param string $text_blocks Variable reference in source template
- * @return bool Whether a replacement occurred or not
- */
- private function compile_language_tags(&$text_blocks)
- {
- $replacements = 0;
-
- // transform vars prefixed by L_ into their language variable pendant if nothing is set within the tpldata array
- if (strpos($text_blocks, '{L_') !== false)
- {
- $text_blocks = preg_replace('#\{L_(' . self::REGEX_VAR_SUFFIX . ')\}#', "<?php echo ((isset(\$_rootref['L_\\1'])) ? \$_rootref['L_\\1'] : ((isset(\$_lang['\\1'])) ? \$_lang['\\1'] : '{ \\1 }')); /**/?>", $text_blocks, -1, $replacements);
- return (bool) $replacements;
- }
-
- // Handle addslashed language variables prefixed with LA_
- // If a template variable already exist, it will be used in favor of it...
- if (strpos($text_blocks, '{LA_') !== false)
- {
- $text_blocks = preg_replace('#\{LA_(' . self::REGEX_VAR_SUFFIX . '+)\}#', "<?php echo ((isset(\$_rootref['LA_\\1'])) ? \$_rootref['LA_\\1'] : ((isset(\$_rootref['L_\\1'])) ? addslashes(\$_rootref['L_\\1']) : ((isset(\$_lang['\\1'])) ? addslashes(\$_lang['\\1']) : '{ \\1 }'))); /**/?>", $text_blocks, -1, $replacements);
- return (bool) $replacements;
- }
-
- return false;
- }
-
- /**
- * Compile blocks
- *
- * @param string $tag_args Block contents in source template
- * @return string compiled template code
- */
- private function compile_tag_block($tag_args)
- {
- $no_nesting = false;
-
- // Is the designer wanting to call another loop in a loop?
- // <!-- BEGIN loop -->
- // <!-- BEGIN !loop2 -->
- // <!-- END !loop2 -->
- // <!-- END loop -->
- // 'loop2' is actually on the same nesting level as 'loop' you assign
- // variables to it with template->assign_block_vars('loop2', array(...))
- if (strpos($tag_args, '!') === 0)
- {
- // Count the number if ! occurrences (not allowed in vars)
- $no_nesting = substr_count($tag_args, '!');
- $tag_args = substr($tag_args, $no_nesting);
- }
-
- // Allow for control of looping (indexes start from zero):
- // foo(2) : Will start the loop on the 3rd entry
- // foo(-2) : Will start the loop two entries from the end
- // foo(3,4) : Will start the loop on the fourth entry and end it on the fifth
- // foo(3,-4) : Will start the loop on the fourth entry and end it four from last
- $match = array();
-
- if (preg_match('#^([^()]*)\(([\-\d]+)(?:,([\-\d]+))?\)$#', $tag_args, $match))
- {
- $tag_args = $match[1];
-
- if ($match[2] < 0)
- {
- $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
- }
- else
- {
- $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
- }
-
- if (!isset($match[3]) || strlen($match[3]) < 1 || $match[3] == -1)
- {
- $loop_end = '$_' . $tag_args . '_count';
- }
- else if ($match[3] >= 0)
- {
- $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
- }
- else //if ($match[3] < -1)
- {
- $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
- }
- }
- else
- {
- $loop_start = 0;
- $loop_end = '$_' . $tag_args . '_count';
- }
-
- $tag_template_php = '';
- array_push($this->block_names, $tag_args);
-
- if ($no_nesting !== false)
- {
- // We need to implode $no_nesting times from the end...
- $block = array_slice($this->block_names, -$no_nesting);
- }
- else
- {
- $block = $this->block_names;
- }
-
- if (sizeof($block) < 2)
- {
- // Block is not nested.
- $tag_template_php = '$_' . $tag_args . "_count = (isset(\$_tpldata['$tag_args'])) ? sizeof(\$_tpldata['$tag_args']) : 0;";
- $varref = "\$_tpldata['$tag_args']";
- }
- else
- {
- // This block is nested.
- // Generate a namespace string for this block.
- $namespace = implode('.', $block);
-
- // Get a reference to the data array for this block that depends on the
- // current indices of all parent blocks.
- $varref = $this->generate_block_data_ref($namespace, false);
-
- // Create the for loop code to iterate over this block.
- $tag_template_php = '$_' . $tag_args . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;';
- }
-
- $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
-
- /**
- * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
- * <code>
- * if (!$offset)
- * {
- * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
- * }
- * </code>
- */
-
- $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
- $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];';
-
- return $tag_template_php;
- }
-
- /**
- * Compile a general expression - much of this is from Smarty with
- * some adaptions for our block level methods
- *
- * @param string $tag_args Expression (tag arguments) in source template
- * @return string compiled template code
- */
- private function compile_expression($tag_args)
- {
- $match = array();
- preg_match_all('/(?:
- "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" |
- \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' |
- [(),] |
- [^\s(),]+)/x', $tag_args, $match);
-
- $tokens = $match[0];
- $is_arg_stack = array();
-
- for ($i = 0, $size = sizeof($tokens); $i < $size; $i++)
- {
- $token = &$tokens[$i];
-
- switch ($token)
- {
- case '!==':
- case '===':
- case '<<':
- case '>>':
- case '|':
- case '^':
- case '&':
- case '~':
- case ')':
- case ',':
- case '+':
- case '-':
- case '*':
- case '/':
- case '@':
- break;
-
- case '==':
- case 'eq':
- $token = '==';
- break;
-
- case '!=':
- case '<>':
- case 'ne':
- case 'neq':
- $token = '!=';
- break;
-
- case '<':
- case 'lt':
- $token = '<';
- break;
-
- case '<=':
- case 'le':
- case 'lte':
- $token = '<=';
- break;
-
- case '>':
- case 'gt':
- $token = '>';
- break;
-
- case '>=':
- case 'ge':
- case 'gte':
- $token = '>=';
- break;
-
- case '&&':
- case 'and':
- $token = '&&';
- break;
-
- case '||':
- case 'or':
- $token = '||';
- break;
-
- case '!':
- case 'not':
- $token = '!';
- break;
-
- case '%':
- case 'mod':
- $token = '%';
- break;
-
- case '(':
- array_push($is_arg_stack, $i);
- break;
-
- case 'is':
- $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
- $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
-
- $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
-
- array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
-
- $i = $is_arg_start;
-
- // no break
-
- default:
- $varrefs = array();
- if (preg_match('#^((?:' . self::REGEX_NS . '\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $token, $varrefs))
- {
- if (!empty($varrefs[1]))
- {
- $namespace = substr($varrefs[1], 0, -1);
- $dot_pos = strrchr($namespace, '.');
- if ($dot_pos !== false)
- {
- $namespace = substr($dot_pos, 1);
- }
-
- // S_ROW_COUNT is deceptive, it returns the current row number not the number of rows
- // hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
- switch ($varrefs[3])
- {
- case 'S_ROW_NUM':
- case 'S_ROW_COUNT':
- $token = "\$_${namespace}_i";
- break;
-
- case 'S_NUM_ROWS':
- $token = "\$_${namespace}_count";
- break;
-
- case 'S_FIRST_ROW':
- $token = "(\$_${namespace}_i == 0)";
- break;
-
- case 'S_LAST_ROW':
- $token = "(\$_${namespace}_i == \$_${namespace}_count - 1)";
- break;
-
- case 'S_BLOCK_NAME':
- $token = "'$namespace'";
- break;
-
- default:
- $token = $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']';
- $token = '(isset(' . $token . ') ? ' . $token . ' : null)';
- break;
- }
- }
- else
- {
- $token = ($varrefs[2]) ? '$_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$_rootref[\'' . $varrefs[3] . '\']';
- $token = '(isset(' . $token . ') ? ' . $token . ' : null)';
- }
-
- }
- else if (preg_match('#^\.((?:' . self::REGEX_NS . '\.?)+)$#s', $token, $varrefs))
- {
- // Allow checking if loops are set with .loopname
- // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
- $blocks = explode('.', $varrefs[1]);
-
- // If the block is nested, we have a reference that we can grab.
- // If the block is not nested, we just go and grab the block from _tpldata
- if (sizeof($blocks) > 1)
- {
- $block = array_pop($blocks);
- $namespace = implode('.', $blocks);
- $varref = $this->generate_block_data_ref($namespace, true);
-
- // Add the block reference for the last child.
- $varref .= "['" . $block . "']";
- }
- else
- {
- $varref = '$_tpldata';
-
- // Add the block reference for the last child.
- $varref .= "['" . $blocks[0] . "']";
- }
- $token = "(isset($varref) ? sizeof($varref) : 0)";
- }
-
- break;
- }
- }
-
- return $tokens;
- }
-
- /**
- * Compile IF tags
- *
- * @param string $tag_args Expression given with IF in source template
- * @param bool $elseif True if compiling an IF tag, false if compiling an ELSEIF tag
- * @return string compiled template code
- */
- private function compile_tag_if($tag_args, $elseif)
- {
- $tokens = $this->compile_expression($tag_args);
-
- $tpl = ($elseif) ? '} else if (' : 'if (';
-
- $tpl .= implode(' ', $tokens);
- $tpl .= ') { ';
-
- return $tpl;
- }
-
- /**
- * Compile DEFINE tags
- *
- * @param string $tag_args Expression given with DEFINE in source template
- * @param bool $op True if compiling a DEFINE tag, false if compiling an UNDEFINE tag
- * @return string compiled template code
- */
- private function compile_tag_define($tag_args, $op)
- {
- $match = array();
- preg_match('#^((?:' . self::REGEX_NS . '\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (.*?))?$#', $tag_args, $match);
-
- if (!empty($match[2]) && !isset($match[3]) && $op)
- {
- // DEFINE tag with ENDDEFINE
- $array = "\$_tpldata['DEFINE']['.vars']";
- $code = 'ob_start(); ';
- $code .= "if (!isset($array)) { $array = array(); } ";
- $code .= "{$array}[] = '{$match[2]}'";
- return $code;
- }
-
- if (empty($match[2]) || (!isset($match[3]) && $op))
- {
- return '';
- }
-
- if (!$op)
- {
- return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ');';
- }
-
- /*
- * Define tags that contain template variables (enclosed in curly brackets)
- * need to be treated differently.
- */
- if (substr($match[3], 1, 1) == '{' && substr($match[3], -2, 1) == '}')
- {
- $parsed_statement = implode(' ', $this->compile_expression(substr($match[3], 2, -2)));
- }
- else
- {
- $parsed_statement = implode(' ', $this->compile_expression($match[3]));
- }
-
- return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $parsed_statement . ';';
- }
-
- /**
- * Compile ENDDEFINE tag
- *
- * @return string compiled template code
- */
- private function compile_tag_enddefine()
- {
- $array = "\$_tpldata['DEFINE']['.vars']";
- $code = "if (!isset($array) || !sizeof($array)) { trigger_error('ENDDEFINE tag without DEFINE in ' . basename(__FILE__), E_USER_ERROR); }";
- $code .= "\$define_var = array_pop($array); ";
- $code .= "\$_tpldata['DEFINE']['.'][\$define_var] = ob_get_clean();";
- return $code;
- }
-
- /**
- * Compile INCLUDE tag
- *
- * @param string $tag_args Expression given with INCLUDE in source template
- * @return string compiled template code
- */
- private function compile_tag_include($tag_args)
- {
- // Process dynamic includes
- if (strpos($tag_args, '{') !== false)
- {
- return $this->parse_dynamic_path($tag_args, '_tpl_include');
- }
-
- return "\$_template->_tpl_include('$tag_args');";
- }
-
- /**
- * Compile INCLUDE_PHP tag
- *
- * @param string $tag_args Expression given with INCLUDEPHP in source template
- * @return string compiled template code
- */
- private function compile_tag_include_php($tag_args)
- {
- if (strpos($tag_args, '{') !== false)
- {
- return $this->parse_dynamic_path($tag_args, '_php_include');
- }
-
- return "\$_template->_php_include('$tag_args');";
- }
-
- /**
- * Compile EVENT tag.
- *
- * $tag_args should be a single string identifying the event.
- * The event name can contain letters, numbers and underscores only.
- * If an invalid event name is specified, an E_USER_ERROR will be
- * triggered.
- *
- * Event tags are only functional when the template engine has
- * an instance of the extension manager. Extension manager would
- * be called upon to find all extensions listening for the specified
- * event, and to obtain additional template fragments. All such
- * template fragments will be compiled and included in the generated
- * compiled template code for the current template being compiled.
- *
- * The above means that whenever an extension is enabled or disabled,
- * template cache should be cleared in order to update the compiled
- * template code for the active set of template event listeners.
- *
- * This also means that extensions cannot return different template
- * fragments at different times. Once templates are compiled, changing
- * such template fragments would have no effect.
- *
- * @param string $tag_args EVENT tag arguments, as a string - for EVENT this is the event name
- * @return string compiled template code
- */
- private function compile_tag_event($tag_args)
- {
- if (!preg_match('/^\w+$/', $tag_args))
- {
- // The event location is improperly formatted,
- if ($this->user)
- {
- trigger_error($this->user->lang('ERR_TEMPLATE_EVENT_LOCATION', $tag_args), E_USER_ERROR);
- }
- else
- {
- trigger_error(sprintf('The specified template event location <em>[%s]</em> is improperly formatted.', $tag_args), E_USER_ERROR);
- }
- }
- $location = $tag_args;
-
- if ($this->extension_manager)
- {
- $finder = $this->extension_manager->get_finder();
-
- $files = $finder
- ->extension_prefix($location)
- ->extension_suffix('.html')
- ->extension_directory("/styles/all/template")
- ->get_files();
-
- foreach ($this->style_names as $style_name)
- {
- $more_files = $finder
- ->extension_prefix($location)
- ->extension_suffix('.html')
- ->extension_directory("/styles/" . $style_name . "/template")
- ->get_files();
- if (!empty($more_files))
- {
- $files = array_merge($files, $more_files);
- break;
- }
- }
-
- $all_compiled = '';
- foreach ($files as $file)
- {
- $this->template_compile->set_filter_params(array(
- 'cleanup' => false,
- ));
-
- $compiled = $this->template_compile->compile_file($file);
-
- $this->template_compile->reset_filter_params();
-
- if ($compiled === false)
- {
- if ($this->user)
- {
- trigger_error($this->user->lang('ERR_TEMPLATE_COMPILATION', phpbb_filter_root_path($file)), E_USER_ERROR);
- }
- else
- {
- trigger_error(sprintf('The file could not be compiled: %s', phpbb_filter_root_path($file)), E_USER_ERROR);
- }
- }
-
- $all_compiled .= $compiled;
- }
- // Need spaces inside php tags as php cannot grok
- // < ?php? > sans the spaces
- return ' ?' . '>' . $all_compiled . '<?php ';
- }
- }
-
- /**
- * parse expression
- * This is from Smarty
- */
- private function _parse_is_expr($is_arg, $tokens)
- {
- $expr_end = 0;
- $negate_expr = false;
-
- if (($first_token = array_shift($tokens)) == 'not')
- {
- $negate_expr = true;
- $expr_type = array_shift($tokens);
- }
- else
- {
- $expr_type = $first_token;
- }
-
- switch ($expr_type)
- {
- case 'even':
- if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by')
- {
- $expr_end++;
- $expr_arg = $tokens[$expr_end++];
- $expr = "!(($is_arg / $expr_arg) & 1)";
- }
- else
- {
- $expr = "!($is_arg & 1)";
- }
- break;
-
- case 'odd':
- if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by')
- {
- $expr_end++;
- $expr_arg = $tokens[$expr_end++];
- $expr = "(($is_arg / $expr_arg) & 1)";
- }
- else
- {
- $expr = "($is_arg & 1)";
- }
- break;
-
- case 'div':
- if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by')
- {
- $expr_end++;
- $expr_arg = $tokens[$expr_end++];
- $expr = "!($is_arg % $expr_arg)";
- }
- break;
- }
-
- if ($negate_expr)
- {
- if ($expr[0] == '!')
- {
- // Negated expression, de-negate it.
- $expr = substr($expr, 1);
- }
- else
- {
- $expr = "!($expr)";
- }
- }
-
- array_splice($tokens, 0, $expr_end, $expr);
-
- return $tokens;
- }
-
- /**
- * Compile INCLUDEJS tag
- *
- * @param string $tag_args Expression given with INCLUDEJS in source template
- * @return string compiled template code
- */
- private function compile_tag_include_js($tag_args)
- {
- // Process dynamic includes
- if (strpos($tag_args, '{') !== false)
- {
- return $this->parse_dynamic_path($tag_args, '_js_include');
- }
-
- // Locate file
- $filename = $this->locator->get_first_file_location(array($tag_args), false, true);
-
- if ($filename === false)
- {
- // File does not exist, find it during run time
- return ' $_template->_js_include(\'' . addslashes($tag_args) . '\', true); ';
- }
-
- if (substr($filename, 0, strlen($this->phpbb_root_path)) != $this->phpbb_root_path)
- {
- // Absolute path, include as is
- return ' $_template->_js_include(\'' . addslashes($filename) . '\', false, false); ';
- }
-
- // Relative path, remove root path from it
- $filename = substr($filename, strlen($this->phpbb_root_path));
- return ' $_template->_js_include(\'' . addslashes($filename) . '\', false, true); ';
- }
-
- /**
- * Generates a reference to the given variable inside the given (possibly nested)
- * block namespace. This is a string of the form:
- * ' . $_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
- * It's ready to be inserted into an "echo" line in one of the templates.
- *
- * @param string $namespace Namespace to access (expects a trailing "." on the namespace)
- * @param string $varname Variable name to use
- * @param bool $expr Returns whether the source was an expression type
- * @param bool $defop If true this is a variable created with the DEFINE construct, otherwise template variable
- * @return string Code to access variable or echo it if $echo is true
- */
- private function generate_block_varref($namespace, $varname, &$expr, $defop = false)
- {
- // Strip the trailing period.
- $namespace = substr($namespace, 0, -1);
-
- if (($pos = strrpos($namespace, '.')) !== false)
- {
- $local_namespace = substr($namespace, $pos + 1);
- }
- else
- {
- $local_namespace = $namespace;
- }
-
- $expr = true;
-
- // S_ROW_COUNT is deceptive, it returns the current row number now the number of rows
- // hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
- switch ($varname)
- {
- case 'S_ROW_NUM':
- case 'S_ROW_COUNT':
- $varref = "\$_${local_namespace}_i";
- break;
-
- case 'S_NUM_ROWS':
- $varref = "\$_${local_namespace}_count";
- break;
-
- case 'S_FIRST_ROW':
- $varref = "(\$_${local_namespace}_i == 0)";
- break;
-
- case 'S_LAST_ROW':
- $varref = "(\$_${local_namespace}_i == \$_${local_namespace}_count - 1)";
- break;
-
- case 'S_BLOCK_NAME':
- $varref = "'$local_namespace'";
- break;
-
- default:
- // Get a reference to the data block for this namespace.
- $varref = $this->generate_block_data_ref($namespace, true, $defop);
- // Prepend the necessary code to stick this in an echo line.
-
- // Append the variable reference.
- $varref .= "['$varname']";
-
- $expr = false;
- break;
- }
- // @todo Test the !$expr more
-
- return $varref;
- }
-
- /**
- * Generates a reference to the array of data values for the given
- * (possibly nested) block namespace. This is a string of the form:
- * $_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
- *
- * @param string $blockname Block to access (does not expect a trailing "." on the blockname)
- * @param bool $include_last_iterator If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
- * @param bool $defop If true this is a variable created with the DEFINE construct, otherwise template variable
- * @return string Code to access variable
- */
- private function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
- {
- // Get an array of the blocks involved.
- $blocks = explode('.', $blockname);
- $blockcount = sizeof($blocks) - 1;
-
- // DEFINE is not an element of any referenced variable, we must use _tpldata to access it
- if ($defop)
- {
- $varref = '$_tpldata[\'DEFINE\']';
- // Build up the string with everything but the last child.
- for ($i = 0; $i < $blockcount; $i++)
- {
- $varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
- }
- // Add the block reference for the last child.
- $varref .= "['" . $blocks[$blockcount] . "']";
- // Add the iterator for the last child if requried.
- if ($include_last_iterator)
- {
- $varref .= '[$_' . $blocks[$blockcount] . '_i]';
- }
- return $varref;
- }
- else if ($include_last_iterator)
- {
- return '$_'. $blocks[$blockcount] . '_val';
- }
- else
- {
- return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
- }
- }
-}
diff --git a/phpBB/includes/template/renderer.php b/phpBB/includes/template/renderer.php
deleted file mode 100644
index 30e234a733..0000000000
--- a/phpBB/includes/template/renderer.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Template renderer interface.
-*
-* Objects implementing this interface encapsulate a means of displaying
-* a template.
-*
-* @package phpBB3
-*/
-interface phpbb_template_renderer
-{
- /**
- * Displays the template managed by this renderer.
- *
- * @param phpbb_template_context $context Template context to use
- * @param array $lang Language entries to use
- */
- public function render($context, $lang);
-}
diff --git a/phpBB/includes/template/renderer_eval.php b/phpBB/includes/template/renderer_eval.php
deleted file mode 100644
index f8e4cb7b10..0000000000
--- a/phpBB/includes/template/renderer_eval.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Template renderer that stores compiled template's php code and
-* displays it via eval.
-*
-* @package phpBB3
-*/
-class phpbb_template_renderer_eval implements phpbb_template_renderer
-{
- /**
- * Template code to be eval'ed.
- */
- private $code;
-
- /**
- * Constructor. Stores provided code for future evaluation.
- * Template includes are delegated to template object $template.
- *
- * @param string $code php code of the template
- * @param phpbb_template $template template object
- */
- public function __construct($code, $template)
- {
- $this->code = $code;
- $this->template = $template;
- }
-
- /**
- * Displays the template managed by this renderer by eval'ing php code
- * of the template.
- *
- * @param phpbb_template_context $context Template context to use
- * @param array $lang Language entries to use
- */
- public function render($context, $lang)
- {
- $_template = $this->template;
- $_tpldata = &$context->get_data_ref();
- $_rootref = &$context->get_root_ref();
- $_lang = $lang;
-
- eval(' ?>' . $this->code . '<?php ');
- }
-}
diff --git a/phpBB/includes/template/renderer_include.php b/phpBB/includes/template/renderer_include.php
deleted file mode 100644
index f5c9026abf..0000000000
--- a/phpBB/includes/template/renderer_include.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-
-/**
-* Template renderer that stores path to php file with template code
-* and displays it by including the file.
-*
-* @package phpBB3
-*/
-class phpbb_template_renderer_include implements phpbb_template_renderer
-{
- /**
- * Template path to be included.
- */
- private $path;
-
- /**
- * Constructor. Stores path to the template for future inclusion.
- * Template includes are delegated to template object $template.
- *
- * @param string $path path to the template
- */
- public function __construct($path, $template)
- {
- $this->path = $path;
- $this->template = $template;
- }
-
- /**
- * Displays the template managed by this renderer by including
- * the php file containing the template.
- *
- * @param phpbb_template_context $context Template context to use
- * @param array $lang Language entries to use
- */
- public function render($context, $lang)
- {
- $_template = $this->template;
- $_tpldata = &$context->get_data_ref();
- $_rootref = &$context->get_root_ref();
- $_lang = $lang;
-
- include($this->path);
- }
-}
diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php
deleted file mode 100644
index bbec768613..0000000000
--- a/phpBB/includes/template/template.php
+++ /dev/null
@@ -1,515 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* @todo
-* IMG_ for image substitution?
-* {IMG_[key]:[alt]:[type]}
-* {IMG_ICON_CONTACT:CONTACT:full} -> $user->img('icon_contact', 'CONTACT', 'full');
-*
-* More in-depth...
-* yadayada
-*/
-
-/**
-* Base Template class.
-* @package phpBB3
-*/
-class phpbb_template
-{
- /**
- * Template context.
- * Stores template data used during template rendering.
- * @var phpbb_template_context
- */
- private $context;
-
- /**
- * Path of the cache directory for the template
- * @var string
- */
- public $cachepath = '';
-
- /**
- * phpBB root path
- * @var string
- */
- private $phpbb_root_path;
-
- /**
- * PHP file extension
- * @var string
- */
- private $php_ext;
-
- /**
- * phpBB config instance
- * @var phpbb_config
- */
- private $config;
-
- /**
- * Current user
- * @var phpbb_user
- */
- private $user;
-
- /**
- * Template locator
- * @var phpbb_template_locator
- */
- private $locator;
-
- /**
- * Extension manager.
- *
- * @var phpbb_extension_manager
- */
- private $extension_manager;
-
- /**
- * Name of the style that the template being compiled and/or rendered
- * belongs to, and its parents, in inheritance tree order.
- *
- * Used to invoke style-specific template events.
- *
- * @var array
- */
- private $style_names;
-
- /**
- * Constructor.
- *
- * @param string $phpbb_root_path phpBB root path
- * @param user $user current user
- * @param phpbb_template_locator $locator template locator
- * @param phpbb_template_context $context template context
- * @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked
- */
- public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_locator $locator, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null)
- {
- $this->phpbb_root_path = $phpbb_root_path;
- $this->php_ext = $php_ext;
- $this->config = $config;
- $this->user = $user;
- $this->locator = $locator;
- $this->context = $context;
- $this->extension_manager = $extension_manager;
- }
-
- /**
- * Sets the template filenames for handles.
- *
- * @param array $filename_array Should be a hash of handle => filename pairs.
- */
- public function set_filenames(array $filename_array)
- {
- $this->locator->set_filenames($filename_array);
-
- return true;
- }
-
- /**
- * Sets the style names corresponding to style hierarchy being compiled
- * and/or rendered.
- *
- * @param array $style_names List of style names in inheritance tree order
- * @return null
- */
- public function set_style_names(array $style_names)
- {
- $this->style_names = $style_names;
- }
-
- /**
- * Clears all variables and blocks assigned to this template.
- */
- public function destroy()
- {
- $this->context->clear();
- }
-
- /**
- * Reset/empty complete block
- *
- * @param string $blockname Name of block to destroy
- */
- public function destroy_block_vars($blockname)
- {
- $this->context->destroy_block_vars($blockname);
- }
-
- /**
- * Display a template for provided handle.
- *
- * The template will be loaded and compiled, if necessary, first.
- *
- * This function calls hooks.
- *
- * @param string $handle Handle to display
- * @return bool True on success, false on failure
- */
- public function display($handle)
- {
- $result = $this->call_hook($handle, __FUNCTION__);
- if ($result !== false)
- {
- return $result[0];
- }
-
- return $this->load_and_render($handle);
- }
-
- /**
- * Loads a template for $handle, compiling it if necessary, and
- * renders the template.
- *
- * @param string $handle Template handle to render
- * @return bool True on success, false on failure
- */
- private function load_and_render($handle)
- {
- $renderer = $this->_tpl_load($handle);
-
- if ($renderer)
- {
- $renderer->render($this->context, $this->get_lang());
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Calls hook if any is defined.
- *
- * @param string $handle Template handle being displayed.
- * @param string $method Method name of the caller.
- */
- private function call_hook($handle, $method)
- {
- global $phpbb_hook;
-
- if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this))
- {
- if ($phpbb_hook->hook_return(array(__CLASS__, $method)))
- {
- $result = $phpbb_hook->hook_return_result(array(__CLASS__, $method));
- return array($result);
- }
- }
-
- return false;
- }
-
- /**
- * Obtains language array.
- * This is either lang property of $user property, or if
- * it is not set an empty array.
- * @return array language entries
- */
- public function get_lang()
- {
- if (isset($this->user->lang))
- {
- $lang = $this->user->lang;
- }
- else
- {
- $lang = array();
- }
- return $lang;
- }
-
- /**
- * Display the handle and assign the output to a template variable
- * or return the compiled result.
- *
- * @param string $handle Handle to operate on
- * @param string $template_var Template variable to assign compiled handle to
- * @param bool $return_content If true return compiled handle, otherwise assign to $template_var
- * @return bool|string false on failure, otherwise if $return_content is true return string of the compiled handle, otherwise return true
- */
- public function assign_display($handle, $template_var = '', $return_content = true)
- {
- ob_start();
- $result = $this->display($handle);
- $contents = ob_get_clean();
- if ($result === false)
- {
- return false;
- }
-
- if ($return_content)
- {
- return $contents;
- }
-
- $this->assign_var($template_var, $contents);
-
- return true;
- }
-
- /**
- * Obtains a template renderer for a template identified by specified
- * handle. The template renderer can display the template later.
- *
- * Template source will first be compiled into php code.
- * If template cache is writable the compiled php code will be stored
- * on filesystem and template will not be subsequently recompiled.
- * If template cache is not writable template source will be recompiled
- * every time it is needed. DEBUG define and load_tplcompile
- * configuration setting may be used to force templates to be always
- * recompiled.
- *
- * Returns an object implementing phpbb_template_renderer, or null
- * if template loading or compilation failed. Call render() on the
- * renderer to display the template. This will result in template
- * contents sent to the output stream (unless, of course, output
- * buffering is in effect).
- *
- * @param string $handle Handle of the template to load
- * @return phpbb_template_renderer Template renderer object, or null on failure
- * @uses phpbb_template_compile is used to compile template source
- */
- private function _tpl_load($handle)
- {
- $output_file = $this->_compiled_file_for_handle($handle);
-
- $recompile = defined('DEBUG') ||
- !file_exists($output_file) ||
- @filesize($output_file) === 0;
-
- if ($recompile || $this->config['load_tplcompile'])
- {
- // Set only if a recompile or an mtime check are required.
- $source_file = $this->locator->get_source_file_for_handle($handle);
-
- if (!$recompile && @filemtime($output_file) < @filemtime($source_file))
- {
- $recompile = true;
- }
- }
-
- // Recompile page if the original template is newer, otherwise load the compiled version
- if (!$recompile)
- {
- return new phpbb_template_renderer_include($output_file, $this);
- }
-
- $compile = new phpbb_template_compile($this->config['tpl_allow_php'], $this->style_names, $this->locator, $this->phpbb_root_path, $this->extension_manager, $this->user);
-
- if ($compile->compile_file_to_file($source_file, $output_file) !== false)
- {
- $renderer = new phpbb_template_renderer_include($output_file, $this);
- }
- else if (($code = $compile->compile_file($source_file)) !== false)
- {
- $renderer = new phpbb_template_renderer_eval($code, $this);
- }
- else
- {
- $renderer = null;
- }
-
- return $renderer;
- }
-
- /**
- * Determines compiled file path for handle $handle.
- *
- * @param string $handle Template handle (i.e. "friendly" template name)
- * @return string Compiled file path
- */
- private function _compiled_file_for_handle($handle)
- {
- $source_file = $this->locator->get_filename_for_handle($handle);
- $compiled_file = $this->cachepath . str_replace('/', '.', $source_file) . '.' . $this->php_ext;
- return $compiled_file;
- }
-
- /**
- * Assign key variable pairs from an array
- *
- * @param array $vararray A hash of variable name => value pairs
- */
- public function assign_vars(array $vararray)
- {
- foreach ($vararray as $key => $val)
- {
- $this->assign_var($key, $val);
- }
- }
-
- /**
- * Assign a single scalar value to a single key.
- *
- * Value can be a string, an integer or a boolean.
- *
- * @param string $varname Variable name
- * @param string $varval Value to assign to variable
- */
- public function assign_var($varname, $varval)
- {
- $this->context->assign_var($varname, $varval);
- }
-
- /**
- * Append text to the string value stored in a key.
- *
- * Text is appended using the string concatenation operator (.).
- *
- * @param string $varname Variable name
- * @param string $varval Value to append to variable
- */
- public function append_var($varname, $varval)
- {
- $this->context->append_var($varname, $varval);
- }
-
- // Docstring is copied from phpbb_template_context method with the same name.
- /**
- * Assign key variable pairs from an array to a specified block
- * @param string $blockname Name of block to assign $vararray to
- * @param array $vararray A hash of variable name => value pairs
- */
- public function assign_block_vars($blockname, array $vararray)
- {
- return $this->context->assign_block_vars($blockname, $vararray);
- }
-
- // Docstring is copied from phpbb_template_context method with the same name.
- /**
- * Change already assigned key variable pair (one-dimensional - single loop entry)
- *
- * An example of how to use this function:
- * {@example alter_block_array.php}
- *
- * @param string $blockname the blockname, for example 'loop'
- * @param array $vararray the var array to insert/add or merge
- * @param mixed $key Key to search for
- *
- * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
- *
- * int: Position [the position to change or insert at directly given]
- *
- * If key is false the position is set to 0
- * If key is true the position is set to the last entry
- *
- * @param string $mode Mode to execute (valid modes are 'insert' and 'change')
- *
- * If insert, the vararray is inserted at the given position (position counting from zero).
- * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
- *
- * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
- * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
- *
- * @return bool false on error, true on success
- */
- public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
- {
- return $this->context->alter_block_array($blockname, $vararray, $key, $mode);
- }
-
- /**
- * Include a separate template.
- *
- * This function is marked public due to the way the template
- * implementation uses it. It is actually an implementation function
- * and should not be considered part of template class's public API.
- *
- * @param string $filename Template filename to include
- * @param bool $include True to include the file, false to just load it
- * @uses template_compile is used to compile uncached templates
- */
- public function _tpl_include($filename, $include = true)
- {
- $this->locator->set_filenames(array($filename => $filename));
-
- if (!$this->load_and_render($filename))
- {
- // trigger_error cannot be used here, as the output already started
- echo 'template->_tpl_include(): Failed including ' . htmlspecialchars($handle) . "\n";
- }
- }
-
- /**
- * Include a PHP file.
- *
- * If a relative path is passed in $filename, it is considered to be
- * relative to board root ($phpbb_root_path). Absolute paths are
- * also allowed.
- *
- * This function is marked public due to the way the template
- * implementation uses it. It is actually an implementation function
- * and should not be considered part of template class's public API.
- *
- * @param string $filename Path to PHP file to include
- */
- public function _php_include($filename)
- {
- if (phpbb_is_absolute($filename))
- {
- $file = $filename;
- }
- else
- {
- $file = $this->phpbb_root_path . $filename;
- }
-
- if (!file_exists($file))
- {
- // trigger_error cannot be used here, as the output already started
- echo 'template->_php_include(): File ' . htmlspecialchars($file) . " does not exist\n";
- return;
- }
- include($file);
- }
-
- /**
- * Include JS file
- *
- * @param string $file file name
- * @param bool $locate True if file needs to be located
- * @param bool $relative True if path is relative to phpBB root directory. Ignored if $locate == true
- */
- public function _js_include($file, $locate = false, $relative = false)
- {
- // Locate file
- if ($locate)
- {
- $located = $this->locator->get_first_file_location(array($file), false, true);
- if ($located)
- {
- $file = $located;
- }
- }
- else if ($relative)
- {
- $file = $this->phpbb_root_path . $file;
- }
-
- $file .= (strpos($file, '?') === false) ? '?' : '&';
- $file .= 'assets_version=' . $this->config['assets_version'];
-
- // Add HTML code
- $code = '<script src="' . htmlspecialchars($file) . '"></script>';
- $this->context->append_var('SCRIPTS', $code);
- }
-}
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index aada0525a8..8620e33e47 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -565,7 +565,7 @@ class ucp_groups
if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour', true))))
{
// Replace "error" string with its real, localised form
- $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error));
+ $error = array_merge($error, $colour_error);
}
if (!sizeof($error))
@@ -613,6 +613,7 @@ class ucp_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/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/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 e0ecc242e1..44cbc74d29 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -102,7 +102,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
-phpbb_require_updated('includes/class_loader.' . $phpEx);
+phpbb_require_updated('phpbb/class_loader.' . $phpEx);
phpbb_require_updated('includes/functions.' . $phpEx);
phpbb_require_updated('includes/functions_content.' . $phpEx);
@@ -116,9 +116,9 @@ phpbb_require_updated('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 = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/includes/", $phpEx);
+$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx);
$phpbb_class_loader_new->register();
-$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}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)
@@ -242,7 +242,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 055fb72d7c..ada1f43905 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -95,7 +95,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
-phpbb_require_updated('includes/class_loader.' . $phpEx);
+phpbb_require_updated('phpbb/class_loader.' . $phpEx);
phpbb_require_updated('includes/functions.' . $phpEx);
phpbb_require_updated('includes/functions_container.' . $phpEx);
@@ -108,9 +108,9 @@ phpbb_include_updated('includes/utf/utf_tools.' . $phpEx);
phpbb_require_updated('includes/functions_install.' . $phpEx);
// Setup class loader first
-$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/includes/", $phpEx);
+$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx);
$phpbb_class_loader_new->register();
-$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}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();
@@ -246,7 +246,7 @@ $config = new phpbb_config(array(
$phpbb_style_resource_locator = new phpbb_style_resource_locator();
$phpbb_style_path_provider = new phpbb_style_path_provider();
-$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, new phpbb_template_context());
+$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context());
$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
$phpbb_style->set_ext_dir_prefix('adm/');
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
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 5bf3f572d9..ea23c318e3 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -53,7 +53,7 @@ class install_install extends module
function main($mode, $sub)
{
global $lang, $template, $language, $phpbb_root_path, $phpEx;
- global $phpbb_container, $cache, $phpbb_log;
+ global $phpbb_container, $cache, $phpbb_log, $request;
switch ($sub)
{
@@ -102,6 +102,9 @@ class install_install extends module
break;
case 'final':
+ // Enable super globals to prevent issues with the new phpbb_request object
+ $request->enable_super_globals();
+
// Create a normal container now
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
@@ -1432,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);
@@ -1885,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.
*
@@ -1897,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 93f163364b..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',
@@ -601,7 +606,7 @@ $lang = array_merge($lang, array(
'LOG_FORUM_MOVE_UP' => '<strong>Moved forum</strong> %1$s <strong>above</strong> %2$s',
'LOG_FORUM_SYNC' => '<strong>Re-synchronised forum</strong><br />» %s',
- 'LOG_GENERAL_ERROR' => '<strong>A general error occured</strong>: %1$s <br />» %2$s',
+ 'LOG_GENERAL_ERROR' => '<strong>A general error occurred</strong>: %1$s <br />» %2$s',
'LOG_GROUP_CREATED' => '<strong>New usergroup created</strong><br />» %s',
'LOG_GROUP_DEFAULTS' => '<strong>Group “%1$s” made default for members</strong><br />» %2$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..98679ad544 100644
--- a/phpBB/language/en/acp/permissions_phpbb.php
+++ b/phpBB/language/en/acp/permissions_phpbb.php
@@ -152,7 +152,8 @@ $lang = array_merge($lang, array(
'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_delete' => array('lang' => 'Can permanently delete own posts', 'cat' => 'post'),
+ 'acl_f_softdelete' => array('lang' => 'Can soft delete own posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>', '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'),
@@ -173,8 +174,9 @@ $lang = array_merge($lang, array(
// 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_delete' => array('lang' => 'Can permanently delete posts', 'cat' => 'post_actions'),
+ 'acl_m_softdelete' => array('lang' => 'Can soft delete posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>', 'cat' => 'post_actions'),
+ 'acl_m_approve' => array('lang' => 'Can approve and restore 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'),
diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php
index 89e171744f..ea3eadb0dd 100644
--- a/phpBB/language/en/acp/posting.php
+++ b/phpBB/language/en/acp/posting.php
@@ -83,7 +83,8 @@ $lang = array_merge($lang, array(
'NUMBER' => 'Any series of digits',
'EMAIL' => 'A valid email address',
'URL' => 'A valid URL using any protocol (http, ftp, etc… cannot be used for javascript exploits). If none is given, “http://” is prefixed to the string.',
- 'LOCAL_URL' => 'A local URL. The URL must be relative to the topic page and cannot contain a server name or protocol.',
+ 'LOCAL_URL' => 'A local URL. The URL must be relative to the topic page and cannot contain a server name or protocol, as links are prefixed with “%s”',
+ 'RELATIVE_URL' => 'A relative URL. You can use this to match parts of a URL, but be careful: a full URL is a valid relative URL. When you want to use relative URLs of your board, use the LOCAL_URL token.',
'COLOR' => 'A HTML colour, can be either in the numeric form <samp>#FF1234</samp> or a <a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-color">CSS colour keyword</a> such as <samp>fuchsia</samp> or <samp>InactiveBorder</samp>'
)
));
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index cdfd3416f5..b188d90f3a 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -204,8 +204,8 @@ $lang = array_merge($lang, array(
'ERR_TEMPLATE_EVENT_LOCATION' => 'The specified template event location <em>[%s]</em> is improperly formatted.',
'ERR_TEMPLATE_COMPILATION' => 'The file could not be compiled: %s',
'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.',
- 'ERR_UNWATCHING' => 'An error occured while trying to unsubscribe.',
- 'ERR_WATCHING' => 'An error occured while trying to subscribe.',
+ 'ERR_UNWATCHING' => 'An error occurred while trying to unsubscribe.',
+ 'ERR_WATCHING' => 'An error occurred while trying to subscribe.',
'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.',
'ERROR' => 'Error',
'EXPAND_VIEW' => 'Expand view',
@@ -338,7 +338,7 @@ $lang = array_merge($lang, array(
'LAST_VISIT' => 'Last visit',
'LDAP_NO_LDAP_EXTENSION' => 'LDAP extension not available.',
'LDAP_NO_SERVER_CONNECTION' => 'Could not connect to LDAP server.',
- 'LDAP_SEARCH_FAILED' => 'An error occured while searching the LDAP directory.',
+ 'LDAP_SEARCH_FAILED' => 'An error occurred while searching the LDAP directory.',
'LEGEND' => 'Legend',
'LOADING' => 'Loading',
'LOCATION' => 'Location',
@@ -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 7607512eab..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.',
@@ -364,7 +364,7 @@ $lang = array_merge($lang, array(
'UNAVAILABLE' => 'Unavailable',
'UNWRITABLE' => 'Unwritable',
'UPDATE_TOPICS_POSTED' => 'Generating topics posted information',
- 'UPDATE_TOPICS_POSTED_ERR' => 'An error occured while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.',
+ 'UPDATE_TOPICS_POSTED_ERR' => 'An error occurred while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.',
'VERIFY_OPTIONS' => 'Verifying conversion options',
'VERSION' => 'Version',
@@ -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/migrator.php b/phpBB/language/en/migrator.php
index f94c27be8c..34dcbf4c52 100644
--- a/phpBB/language/en/migrator.php
+++ b/phpBB/language/en/migrator.php
@@ -45,7 +45,7 @@ $lang = array_merge($lang, array(
'MIGRATION_NOT_FULFILLABLE' => 'The migration "%1$s" is not fulfillable, missing migration "%2$s".',
'MIGRATION_SCHEMA_DONE' => 'Installed Schema: %s',
- 'MODULE_ERROR' => 'An error occured while creating a module: %s',
+ 'MODULE_ERROR' => 'An error occurred while creating a module: %s',
'MODULE_INFO_FILE_NOT_EXIST' => 'A required module info file is missing: %2$s',
'MODULE_NOT_EXIST' => 'A required module does not exist: %s',
diff --git a/phpBB/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 2535247571..279959974d 100644
--- a/phpBB/includes/auth/auth.php
+++ b/phpBB/phpbb/auth/auth.php
@@ -927,15 +927,14 @@ class phpbb_auth
*/
function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0)
{
- global $config, $db, $user, $phpbb_root_path, $phpEx;
+ global $config, $db, $user, $phpbb_root_path, $phpEx, $phpbb_container;
$method = trim(basename($config['auth_method']));
- include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
- $method = 'login_' . $method;
- if (function_exists($method))
+ $provider = $phpbb_container->get('auth.provider.' . $method);
+ if ($provider)
{
- $login = $method($username, $password, $user->ip, $user->browser, $user->forwarded_for);
+ $login = $provider->login($username, $password);
// If the auth module wants us to create an empty profile do so and then treat the status as LOGIN_SUCCESS
if ($login['status'] == LOGIN_SUCCESS_CREATE_PROFILE)
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/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php
new file mode 100644
index 0000000000..2e80436f78
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/apache.php
@@ -0,0 +1,259 @@
+<?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;
+}
+
+/**
+ * Apache authentication provider for phpBB3
+ *
+ * @package auth
+ */
+class phpbb_auth_provider_apache extends phpbb_auth_provider_base
+{
+ /**
+ * Apache Authentication Constructor
+ *
+ * @param phpbb_db_driver $db
+ * @param phpbb_config $config
+ * @param phpbb_request $request
+ * @param phpbb_user $user
+ * @param string $phpbb_root_path
+ * @param string $php_ext
+ */
+ public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $phpbb_root_path, $php_ext)
+ {
+ $this->db = $db;
+ $this->config = $config;
+ $this->request = $request;
+ $this->user = $user;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function init()
+ {
+ if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')))
+ {
+ return $this->user->lang['APACHE_SETUP_BEFORE_USE'];
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function login($username, $password)
+ {
+ // do not allow empty password
+ if (!$password)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD,
+ 'error_msg' => 'NO_PASSWORD_SUPPLIED',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!$username)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'));
+ $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW'));
+
+ if (!empty($php_auth_user) && !empty($php_auth_pw))
+ {
+ if ($php_auth_user !== $username)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
+ FROM ' . USERS_TABLE . "
+ WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if ($row)
+ {
+ // User inactive...
+ if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ACTIVE,
+ 'error_msg' => 'ACTIVE_ERROR',
+ 'user_row' => $row,
+ );
+ }
+
+ // Successful login...
+ return array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => $row,
+ );
+ }
+
+ // this is the user's first login so create an empty profile
+ return array(
+ 'status' => LOGIN_SUCCESS_CREATE_PROFILE,
+ 'error_msg' => false,
+ 'user_row' => user_row_apache($php_auth_user, $php_auth_pw),
+ );
+ }
+
+ // Not logged into apache
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function autologin()
+ {
+ if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
+ {
+ return array();
+ }
+
+ $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'));
+ $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW'));
+
+ if (!empty($php_auth_user) && !empty($php_auth_pw))
+ {
+ set_var($php_auth_user, $php_auth_user, 'string', true);
+ set_var($php_auth_pw, $php_auth_pw, 'string', true);
+
+ $sql = 'SELECT *
+ FROM ' . USERS_TABLE . "
+ WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if ($row)
+ {
+ return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? array() : $row;
+ }
+
+ if (!function_exists('user_add'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
+ }
+
+ // create the user if he does not exist yet
+ user_add(user_row_apache($php_auth_user, $php_auth_pw));
+
+ $sql = 'SELECT *
+ FROM ' . USERS_TABLE . "
+ WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($php_auth_user)) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if ($row)
+ {
+ return $row;
+ }
+ }
+
+ return array();
+ }
+
+ /**
+ * This function generates an array which can be passed to the user_add
+ * function in order to create a user
+ *
+ * @param string $username The username of the new user.
+ * @param string $password The password of the new user.
+ * @return array Contains data that can be passed directly to
+ * the user_add function.
+ */
+ private function user_row($username, $password)
+ {
+ // first retrieve default group id
+ $sql = 'SELECT group_id
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "'
+ AND group_type = " . GROUP_SPECIAL;
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$row)
+ {
+ trigger_error('NO_GROUP');
+ }
+
+ // generate user account data
+ return array(
+ 'username' => $username,
+ 'user_password' => phpbb_hash($password),
+ 'user_email' => '',
+ 'group_id' => (int) $row['group_id'],
+ 'user_type' => USER_NORMAL,
+ 'user_ip' => $this->user->ip,
+ 'user_new' => ($this->config['new_member_post_limit']) ? 1 : 0,
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function validate_session($user)
+ {
+ // Check if PHP_AUTH_USER is set and handle this case
+ if ($this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
+ {
+ $php_auth_user = $this->request->server('PHP_AUTH_USER');
+
+ return ($php_auth_user === $user['username']) ? true : false;
+ }
+
+ // PHP_AUTH_USER is not set. A valid session is now determined by the user type (anonymous/bot or not)
+ if ($user['user_type'] == USER_IGNORE)
+ {
+ return true;
+ }
+
+ return false;
+ }
+}
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/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php
new file mode 100644
index 0000000000..0934c56d9b
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/db.php
@@ -0,0 +1,297 @@
+<?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;
+}
+
+/**
+ * Database authentication provider for phpBB3
+ *
+ * This is for authentication via the integrated user table
+ *
+ * @package auth
+ */
+class phpbb_auth_provider_db extends phpbb_auth_provider_base
+{
+
+ /**
+ * Database Authentication Constructor
+ *
+ * @param phpbb_db_driver $db
+ * @param phpbb_config $config
+ * @param phpbb_request $request
+ * @param phpbb_user $user
+ * @param string $phpbb_root_path
+ * @param string $php_ext
+ */
+ public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $phpbb_root_path, $php_ext)
+ {
+ $this->db = $db;
+ $this->config = $config;
+ $this->request = $request;
+ $this->user = $user;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function login($username, $password)
+ {
+ // Auth plugins get the password untrimmed.
+ // For compatibility we trim() here.
+ $password = trim($password);
+
+ // do not allow empty password
+ if (!$password)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD,
+ 'error_msg' => 'NO_PASSWORD_SUPPLIED',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!$username)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $username_clean = utf8_clean_string($username);
+
+ $sql = 'SELECT user_id, username, user_password, user_passchg, user_pass_convert, user_email, user_type, user_login_attempts
+ FROM ' . USERS_TABLE . "
+ WHERE username_clean = '" . $this->db->sql_escape($username_clean) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (($this->user->ip && !$this->config['ip_login_limit_use_forwarded']) ||
+ ($this->user->forwarded_for && $this->config['ip_login_limit_use_forwarded']))
+ {
+ $sql = 'SELECT COUNT(*) AS attempts
+ FROM ' . LOGIN_ATTEMPT_TABLE . '
+ WHERE attempt_time > ' . (time() - (int) $this->config['ip_login_limit_time']);
+ if ($this->config['ip_login_limit_use_forwarded'])
+ {
+ $sql .= " AND attempt_forwarded_for = '" . $this->db->sql_escape($this->user->forwarded_for) . "'";
+ }
+ else
+ {
+ $sql .= " AND attempt_ip = '" . $this->db->sql_escape($this->user->ip) . "' ";
+ }
+
+ $result = $this->db->sql_query($sql);
+ $attempts = (int) $this->db->sql_fetchfield('attempts');
+ $this->db->sql_freeresult($result);
+
+ $attempt_data = array(
+ 'attempt_ip' => $this->user->ip,
+ 'attempt_browser' => trim(substr($this->user->browser, 0, 149)),
+ 'attempt_forwarded_for' => $this->user->forwarded_for,
+ 'attempt_time' => time(),
+ 'user_id' => ($row) ? (int) $row['user_id'] : 0,
+ 'username' => $username,
+ 'username_clean' => $username_clean,
+ );
+ $sql = 'INSERT INTO ' . LOGIN_ATTEMPT_TABLE . $this->db->sql_build_array('INSERT', $attempt_data);
+ $result = $this->db->sql_query($sql);
+ }
+ else
+ {
+ $attempts = 0;
+ }
+
+ if (!$row)
+ {
+ if ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max'])
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ATTEMPTS,
+ 'error_msg' => 'LOGIN_ERROR_ATTEMPTS',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $show_captcha = ($this->config['max_login_attempts'] && $row['user_login_attempts'] >= $this->config['max_login_attempts']) ||
+ ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']);
+
+ // If there are too many login attempts, we need to check for a confirm image
+ // Every auth module is able to define what to do by itself...
+ if ($show_captcha)
+ {
+ // Visual Confirmation handling
+ if (!class_exists('phpbb_captcha_factory', false))
+ {
+ include ($this->phpbb_root_path . 'includes/captcha/captcha_factory.' . $this->php_ext);
+ }
+
+ $captcha = phpbb_captcha_factory::get_instance($this->config['captcha_plugin']);
+ $captcha->init(CONFIRM_LOGIN);
+ $vc_response = $captcha->validate($row);
+ if ($vc_response)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ATTEMPTS,
+ 'error_msg' => 'LOGIN_ERROR_ATTEMPTS',
+ 'user_row' => $row,
+ );
+ }
+ else
+ {
+ $captcha->reset();
+ }
+
+ }
+
+ // If the password convert flag is set we need to convert it
+ if ($row['user_pass_convert'])
+ {
+ // enable super globals to get literal value
+ // this is needed to prevent unicode normalization
+ $super_globals_disabled = $this->request->super_globals_disabled();
+ if ($super_globals_disabled)
+ {
+ $this->request->enable_super_globals();
+ }
+
+ // in phpBB2 passwords were used exactly as they were sent, with addslashes applied
+ $password_old_format = isset($_REQUEST['password']) ? (string) $_REQUEST['password'] : '';
+ $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format;
+ $password_new_format = $this->request->variable('password', '', true);
+
+ if ($super_globals_disabled)
+ {
+ $this->request->disable_super_globals();
+ }
+
+ if ($password == $password_new_format)
+ {
+ if (!function_exists('utf8_to_cp1252'))
+ {
+ include($this->phpbb_root_path . 'includes/utf/data/recode_basic.' . $this->php_ext);
+ }
+
+ // cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding
+ // plain md5 support left in for conversions from other systems.
+ if ((strlen($row['user_password']) == 34 && (phpbb_check_hash(md5($password_old_format), $row['user_password']) || phpbb_check_hash(md5(utf8_to_cp1252($password_old_format)), $row['user_password'])))
+ || (strlen($row['user_password']) == 32 && (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password'])))
+ {
+ $hash = phpbb_hash($password_new_format);
+
+ // Update the password in the users table to the new format and remove user_pass_convert flag
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_password = \'' . $this->db->sql_escape($hash) . '\',
+ user_pass_convert = 0
+ WHERE user_id = ' . $row['user_id'];
+ $this->db->sql_query($sql);
+
+ $row['user_pass_convert'] = 0;
+ $row['user_password'] = $hash;
+ }
+ else
+ {
+ // Although we weren't able to convert this password we have to
+ // increase login attempt count to make sure this cannot be exploited
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_login_attempts = user_login_attempts + 1
+ WHERE user_id = ' . (int) $row['user_id'] . '
+ AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX;
+ $this->db->sql_query($sql);
+
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD_CONVERT,
+ 'error_msg' => 'LOGIN_ERROR_PASSWORD_CONVERT',
+ 'user_row' => $row,
+ );
+ }
+ }
+ }
+
+ // Check password ...
+ if (!$row['user_pass_convert'] && phpbb_check_hash($password, $row['user_password']))
+ {
+ // Check for old password hash...
+ if (strlen($row['user_password']) == 32)
+ {
+ $hash = phpbb_hash($password);
+
+ // Update the password in the users table to the new format
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_password = '" . $this->db->sql_escape($hash) . "',
+ user_pass_convert = 0
+ WHERE user_id = {$row['user_id']}";
+ $this->db->sql_query($sql);
+
+ $row['user_password'] = $hash;
+ }
+
+ $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . '
+ WHERE user_id = ' . $row['user_id'];
+ $this->db->sql_query($sql);
+
+ if ($row['user_login_attempts'] != 0)
+ {
+ // Successful, reset login attempts (the user passed all stages)
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_login_attempts = 0
+ WHERE user_id = ' . $row['user_id'];
+ $this->db->sql_query($sql);
+ }
+
+ // User inactive...
+ if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ACTIVE,
+ 'error_msg' => 'ACTIVE_ERROR',
+ 'user_row' => $row,
+ );
+ }
+
+ // Successful login... set user_login_attempts to zero...
+ return array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => $row,
+ );
+ }
+
+ // Password incorrect - increase login attempts
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_login_attempts = user_login_attempts + 1
+ WHERE user_id = ' . (int) $row['user_id'] . '
+ AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX;
+ $this->db->sql_query($sql);
+
+ // Give status about wrong password...
+ return array(
+ 'status' => ($show_captcha) ? LOGIN_ERROR_ATTEMPTS : LOGIN_ERROR_PASSWORD,
+ 'error_msg' => ($show_captcha) ? 'LOGIN_ERROR_ATTEMPTS' : 'LOGIN_ERROR_PASSWORD',
+ 'user_row' => $row,
+ );
+ }
+}
diff --git a/phpBB/includes/search/index.htm b/phpBB/phpbb/auth/provider/index.htm
index ee1f723a7d..ee1f723a7d 100644
--- a/phpBB/includes/search/index.htm
+++ b/phpBB/phpbb/auth/provider/index.htm
diff --git a/phpBB/phpbb/auth/provider/interface.php b/phpBB/phpbb/auth/provider/interface.php
new file mode 100644
index 0000000000..47043bc107
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/interface.php
@@ -0,0 +1,105 @@
+<?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;
+}
+
+/**
+ * The interface authentication provider classes have to implement.
+ *
+ * @package auth
+ */
+interface phpbb_auth_provider_interface
+{
+ /**
+ * Checks whether the user is currently identified to the authentication
+ * provider.
+ * Called in acp_board while setting authentication plugins.
+ * Changing to an authentication provider will not be permitted in acp_board
+ * if there is an error.
+ *
+ * @return boolean|string False if the user is identified, otherwise an
+ * error message, or null if not implemented.
+ */
+ public function init();
+
+ /**
+ * Performs login.
+ *
+ * @param string $username The name of the user being authenticated.
+ * @param string $password The password of the user.
+ * @return array An associative array of the format:
+ * array(
+ * 'status' => status constant
+ * 'error_msg' => string
+ * 'user_row' => array
+ * )
+ */
+ public function login($username, $password);
+
+ /**
+ * Autologin function
+ *
+ * @return array|null containing the user row, empty if no auto login
+ * should take place, or null if not impletmented.
+ */
+ public function autologin();
+
+ /**
+ * This function is used to output any required fields in the authentication
+ * admin panel. It also defines any required configuration table fields.
+ *
+ * @return array|null Returns null if not implemented or an array of the
+ * 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(
+ * 'TEMPLATE_FILE' => string,
+ * 'TEMPLATE_VARS' => array(...),
+ * )
+ */
+ public function get_acp_template($new_config);
+
+ /**
+ * Performs additional actions during logout.
+ *
+ * @param array $data An array corresponding to
+ * phpbb_session::data
+ * @param boolean $new_session True for a new session, false for no new
+ * session.
+ */
+ public function logout($data, $new_session);
+
+ /**
+ * The session validation function checks whether the user is still logged
+ * into phpBB.
+ *
+ * @param array $user
+ * @return boolean true if the given user is authenticated, false if the
+ * session should be closed, or null if not implemented.
+ */
+ public function validate_session($user);
+}
diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php
new file mode 100644
index 0000000000..0196529408
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/ldap.php
@@ -0,0 +1,346 @@
+<?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;
+}
+
+/**
+ * Database authentication provider for phpBB3
+ *
+ * This is for authentication via the integrated user table
+ *
+ * @package auth
+ */
+class phpbb_auth_provider_ldap extends phpbb_auth_provider_base
+{
+ /**
+ * LDAP Authentication Constructor
+ *
+ * @param phpbb_db_driver $db
+ * @param phpbb_config $config
+ * @param phpbb_user $user
+ */
+ public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_user $user)
+ {
+ $this->db = $db;
+ $this->config = $config;
+ $this->user = $user;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function init()
+ {
+ if (!@extension_loaded('ldap'))
+ {
+ return $this->user->lang['LDAP_NO_LDAP_EXTENSION'];
+ }
+
+ $this->config['ldap_port'] = (int) $this->config['ldap_port'];
+ if ($this->config['ldap_port'])
+ {
+ $ldap = @ldap_connect($this->config['ldap_server'], $this->config['ldap_port']);
+ }
+ else
+ {
+ $ldap = @ldap_connect($this->config['ldap_server']);
+ }
+
+ if (!$ldap)
+ {
+ return $this->user->lang['LDAP_NO_SERVER_CONNECTION'];
+ }
+
+ @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
+ @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
+
+ if ($this->config['ldap_user'] || $this->config['ldap_password'])
+ {
+ if (!@ldap_bind($ldap, htmlspecialchars_decode($this->config['ldap_user']), htmlspecialchars_decode($this->config['ldap_password'])))
+ {
+ return $this->user->lang['LDAP_INCORRECT_USER_PASSWORD'];
+ }
+ }
+
+ // ldap_connect only checks whether the specified server is valid, so the connection might still fail
+ $search = @ldap_search(
+ $ldap,
+ htmlspecialchars_decode($this->config['ldap_base_dn']),
+ $this->ldap_user_filter($this->user->data['username']),
+ (empty($this->config['ldap_email'])) ?
+ array(htmlspecialchars_decode($this->config['ldap_uid'])) :
+ array(htmlspecialchars_decode($this->config['ldap_uid']), htmlspecialchars_decode($this->config['ldap_email'])),
+ 0,
+ 1
+ );
+
+ if ($search === false)
+ {
+ return $this->user->lang['LDAP_SEARCH_FAILED'];
+ }
+
+ $result = @ldap_get_entries($ldap, $search);
+
+ @ldap_close($ldap);
+
+
+ if (!is_array($result) || sizeof($result) < 2)
+ {
+ return sprintf($this->user->lang['LDAP_NO_IDENTITY'], $this->user->data['username']);
+ }
+
+ if (!empty($this->config['ldap_email']) && !isset($result[0][htmlspecialchars_decode($this->config['ldap_email'])]))
+ {
+ return $this->user->lang['LDAP_NO_EMAIL'];
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function login($username, $password)
+ {
+ // do not allow empty password
+ if (!$password)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD,
+ 'error_msg' => 'NO_PASSWORD_SUPPLIED',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!$username)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ if (!@extension_loaded('ldap'))
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LDAP_NO_LDAP_EXTENSION',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ $this->config['ldap_port'] = (int) $this->config['ldap_port'];
+ if ($this->config['ldap_port'])
+ {
+ $ldap = @ldap_connect($this->config['ldap_server'], $this->config['ldap_port']);
+ }
+ else
+ {
+ $ldap = @ldap_connect($this->config['ldap_server']);
+ }
+
+ if (!$ldap)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LDAP_NO_SERVER_CONNECTION',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
+ @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
+
+ if ($this->config['ldap_user'] || $this->config['ldap_password'])
+ {
+ if (!@ldap_bind($ldap, htmlspecialchars_decode($this->config['ldap_user']), htmlspecialchars_decode($this->config['ldap_password'])))
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LDAP_NO_SERVER_CONNECTION',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+ }
+
+ $search = @ldap_search(
+ $ldap,
+ htmlspecialchars_decode($this->config['ldap_base_dn']),
+ $this->ldap_user_filter($username),
+ (empty($this->config['ldap_email'])) ?
+ array(htmlspecialchars_decode($this->config['ldap_uid'])) :
+ array(htmlspecialchars_decode($this->config['ldap_uid']), htmlspecialchars_decode($this->config['ldap_email'])),
+ 0,
+ 1
+ );
+
+ $ldap_result = @ldap_get_entries($ldap, $search);
+
+ if (is_array($ldap_result) && sizeof($ldap_result) > 1)
+ {
+ if (@ldap_bind($ldap, $ldap_result[0]['dn'], htmlspecialchars_decode($password)))
+ {
+ @ldap_close($ldap);
+
+ $sql ='SELECT user_id, username, user_password, user_passchg, user_email, user_type
+ FROM ' . USERS_TABLE . "
+ WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'";
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if ($row)
+ {
+ unset($ldap_result);
+
+ // User inactive...
+ if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_ACTIVE,
+ 'error_msg' => 'ACTIVE_ERROR',
+ 'user_row' => $row,
+ );
+ }
+
+ // Successful login... set user_login_attempts to zero...
+ return array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => $row,
+ );
+ }
+ else
+ {
+ // retrieve default group id
+ $sql = 'SELECT group_id
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "'
+ AND group_type = " . GROUP_SPECIAL;
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$row)
+ {
+ trigger_error('NO_GROUP');
+ }
+
+ // generate user account data
+ $ldap_user_row = array(
+ 'username' => $username,
+ 'user_password' => phpbb_hash($password),
+ 'user_email' => (!empty($this->config['ldap_email'])) ? utf8_htmlspecialchars($ldap_result[0][htmlspecialchars_decode($this->config['ldap_email'])][0]) : '',
+ 'group_id' => (int) $row['group_id'],
+ 'user_type' => USER_NORMAL,
+ 'user_ip' => $this->user->ip,
+ 'user_new' => ($this->config['new_member_post_limit']) ? 1 : 0,
+ );
+
+ unset($ldap_result);
+
+ // this is the user's first login so create an empty profile
+ return array(
+ 'status' => LOGIN_SUCCESS_CREATE_PROFILE,
+ 'error_msg' => false,
+ 'user_row' => $ldap_user_row,
+ );
+ }
+ }
+ else
+ {
+ unset($ldap_result);
+ @ldap_close($ldap);
+
+ // Give status about wrong password...
+ return array(
+ 'status' => LOGIN_ERROR_PASSWORD,
+ 'error_msg' => 'LOGIN_ERROR_PASSWORD',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+ }
+
+ @ldap_close($ldap);
+
+ return array(
+ 'status' => LOGIN_ERROR_USERNAME,
+ 'error_msg' => 'LOGIN_ERROR_USERNAME',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+
+ public function acp()
+ {
+ // 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 get_acp_template($new_config)
+ {
+ return array(
+ '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'],
+ ),
+ );
+ }
+
+ /**
+ * Generates a filter string for ldap_search to find a user
+ *
+ * @param $username string Username identifying the searched user
+ *
+ * @return string A filter string for ldap_search
+ */
+ private function ldap_user_filter($username)
+ {
+ $filter = '(' . $this->config['ldap_uid'] . '=' . $this->ldap_escape(htmlspecialchars_decode($username)) . ')';
+ if ($this->config['ldap_user_filter'])
+ {
+ $_filter = ($this->config['ldap_user_filter'][0] == '(' && substr($this->config['ldap_user_filter'], -1) == ')') ? $this->config['ldap_user_filter'] : "({$this->config['ldap_user_filter']})";
+ $filter = "(&{$filter}{$_filter})";
+ }
+ return $filter;
+ }
+
+ /**
+ * Escapes an LDAP AttributeValue
+ *
+ * @param string $string The string to be escaped
+ * @return string The escaped string
+ */
+ private function ldap_escape($string)
+ {
+ return str_replace(array('*', '\\', '(', ')'), array('\\*', '\\\\', '\\(', '\\)'), $string);
+ }
+}
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..7da58107a1 100644
--- a/phpBB/includes/avatar/driver/remote.php
+++ b/phpBB/phpbb/avatar/driver/remote.php
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 ee469aa9c8..95dfc8da8e 100644
--- a/phpBB/includes/controller/resolver.php
+++ b/phpBB/phpbb/controller/resolver.php
@@ -38,15 +38,23 @@ class phpbb_controller_resolver implements ControllerResolverInterface
protected $container;
/**
+ * phpbb_style object
+ * @var phpbb_style
+ */
+ protected $style;
+
+ /**
* Construct method
*
* @param phpbb_user $user User Object
* @param ContainerInterface $container ContainerInterface object
+ * @param phpbb_style $style
*/
- public function __construct(phpbb_user $user, ContainerInterface $container)
+ public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null)
{
$this->user = $user;
$this->container = $container;
+ $this->style = $style;
}
/**
@@ -80,6 +88,24 @@ class phpbb_controller_resolver implements ControllerResolverInterface
$controller_object = $this->container->get($service);
+ /*
+ * If this is an extension controller, we'll try to automatically set
+ * the style paths for the extension (the ext author can change them
+ * if necessary).
+ */
+ $controller_dir = explode('_', get_class($controller_object));
+
+ // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ...
+ if (!is_null($this->style) && isset($controller_dir[3]) && $controller_dir[1] === 'ext')
+ {
+ $controller_style_dir = 'ext/' . $controller_dir[2] . '/' . $controller_dir[3] . '/styles';
+
+ if (is_dir($controller_style_dir))
+ {
+ $this->style->set_style(array($controller_style_dir, 'styles'));
+ }
+ }
+
return array($controller_object, $method);
}
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 cde9d332ba..a1d1a5d5dd 100644
--- a/phpBB/includes/db/driver/mssql_odbc.php
+++ b/phpBB/phpbb/db/driver/mssql_odbc.php
@@ -253,7 +253,7 @@ class phpbb_db_driver_mssql_odbc extends phpbb_db_driver_mssql_base
* Fetch current row
* @note number of bytes returned depends on odbc.defaultlrl php.ini setting. If it is limited to 4K for example only 4K of data is returned max.
*/
- function sql_fetchrow($query_id = false, $debug = false)
+ function sql_fetchrow($query_id = false)
{
global $cache;
diff --git a/phpBB/includes/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php
index 6f433e10cf..28fc88298a 100644
--- a/phpBB/includes/db/driver/mssqlnative.php
+++ b/phpBB/phpbb/db/driver/mssqlnative.php
@@ -326,7 +326,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
$this->sql_report('stop', $query);
}
- if ($cache_ttl)
+ if ($cache && $cache_ttl)
{
$this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
@@ -394,7 +394,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
*/
function sql_affectedrows()
{
- return (!empty($this->query_result)) ? @sqlsrv_rows_affected($this->query_result) : false;
+ return ($this->db_connect_id) ? @sqlsrv_rows_affected($this->query_result) : false;
}
/**
@@ -409,7 +409,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
$query_id = $this->query_result;
}
- if ($cache->sql_exists($query_id))
+ if ($cache && $cache->sql_exists($query_id))
{
return $cache->sql_fetchrow($query_id);
}
@@ -474,9 +474,9 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
return $cache->sql_freeresult($query_id);
}
- if (isset($this->open_queries[$query_id]))
+ if (isset($this->open_queries[(int) $query_id]))
{
- unset($this->open_queries[$query_id]);
+ unset($this->open_queries[(int) $query_id]);
return @sqlsrv_free_stmt($query_id);
}
return false;
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/phpbb/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php
new file mode 100644
index 0000000000..f324b8880d
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php
@@ -0,0 +1,57 @@
+<?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_30x_local_url_bbcode extends phpbb_db_migration
+{
+ static public function depends_on()
+ {
+ return array('phpbb_db_migration_data_30x_3_0_12_rc1');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(array($this, 'update_local_url_bbcode'))),
+ );
+ }
+
+ /**
+ * Update BBCodes that currently use the LOCAL_URL tag
+ *
+ * To fix http://tracker.phpbb.com/browse/PHPBB3-8319 we changed
+ * the second_pass_replace value, so that needs updating for existing ones
+ */
+ public function update_local_url_bbcode()
+ {
+ $sql = 'SELECT *
+ FROM ' . BBCODES_TABLE . '
+ WHERE bbcode_match ' . $this->db->sql_like_expression($this->db->any_char . 'LOCAL_URL' . $this->db->any_char);
+ $result = $this->db->sql_query($sql);
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ if (!class_exists('acp_bbcodes'))
+ {
+ global $phpEx;
+ phpbb_require_updated('includes/acp/acp_bbcodes.' . $phpEx);
+ }
+ $bbcode_match = $row['bbcode_match'];
+ $bbcode_tpl = $row['bbcode_tpl'];
+
+ $acp_bbcodes = new acp_bbcodes();
+ $sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl);
+
+ $sql = 'UPDATE ' . BBCODES_TABLE . '
+ SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
+ WHERE bbcode_id = ' . (int) $row['bbcode_id'];
+ $this->sql_query($sql);
+ }
+ $this->db->sql_freeresult($result);
+ }
+}
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/phpbb/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php
new file mode 100644
index 0000000000..e4fbb27bcb
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php
@@ -0,0 +1,51 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_310_signature_module_auth extends phpbb_db_migration
+{
+ public function effectively_installed()
+ {
+ $sql = 'SELECT module_auth
+ FROM ' . MODULES_TABLE . "
+ WHERE module_class = 'ucp'
+ AND module_basename = 'ucp_profile'
+ AND module_mode = 'signature'";
+ $result = $this->db->sql_query($sql);
+ $module_auth = $this->db_sql_fetchfield('module_auth');
+ $this->db->sql_freeresult($result);
+
+ return $module_auth === 'acl_u_sig' || $module_auth === false;
+ }
+
+ static public function depends_on()
+ {
+ return array('phpbb_db_migration_data_31x_dev');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(
+ array($this, 'update_signature_module_auth'),
+ ),
+ ),
+ );
+ }
+
+ public function update_signature_module_auth()
+ {
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET module_auth = 'acl_u_sig'
+ WHERE module_class = 'ucp'
+ AND module_basename = 'ucp_profile'
+ AND module_mode = 'signature'
+ AND module_auth = ''";
+ $this->db->sql_query($sql);
+ }
+}
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 5f14a6953c..0ffa96fd14 100644
--- a/phpBB/includes/db/migration/migration.php
+++ b/phpBB/phpbb/db/migration/migration.php
@@ -44,7 +44,7 @@ abstract class phpbb_db_migration
/** @var string */
protected $php_ext;
- /** @var array Errors, if any occured */
+ /** @var array Errors, if any occurred */
protected $errors;
/** @var array List of queries executed through $this->sql_query() */
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 9d59a24b7e..9d59a24b7e 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..869df7cde0 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_visibility_sql('post', array(), '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..36f958ac60 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_replies, t.topic_type
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . FORUMS_TABLE . ' f
ON (f.forum_id = t.forum_id)
@@ -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/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 aa493c3281..7dc4da8ffe 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -140,7 +140,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
/**
* Checks for correct MySQL version and stores min/max word length in the config
*
- * @return string|bool Language key of the error/incompatiblity occured
+ * @return string|bool Language key of the error/incompatiblity occurred
*/
public function init()
{
@@ -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
@@ -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 496a29f5a3..6b4b310f2e 100644
--- a/phpBB/includes/search/fulltext_postgres.php
+++ b/phpBB/phpbb/search/fulltext_postgres.php
@@ -185,7 +185,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
/**
* Checks for correct PostgreSQL version and stores min/max word length in the config
*
- * @return string|bool Language key of the error/incompatiblity occured
+ * @return string|bool Language key of the error/incompatiblity occurred
*/
public function init()
{
@@ -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 63e35eb4af..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
@@ -611,7 +614,7 @@ class phpbb_search_fulltext_sphinx
$result_count = $result['total_found'];
- if ($start >= $result_count)
+ if ($result_count && $start >= $result_count)
{
$start = floor(($result_count - 1) / $per_page) * $per_page;
@@ -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/phpbb/search/index.htm b/phpBB/phpbb/search/index.htm
new file mode 100644
index 0000000000..ee1f723a7d
--- /dev/null
+++ b/phpBB/phpbb/search/index.htm
@@ -0,0 +1,10 @@
+<html>
+<head>
+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+
+</body>
+</html>
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 6bc71da0c1..e0585b1523 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/phpbb/session.php
@@ -207,7 +207,7 @@ class phpbb_session
function session_begin($update_session_page = true)
{
global $phpEx, $SID, $_SID, $_EXTRA_URL, $db, $config, $phpbb_root_path;
- global $request;
+ global $request, $phpbb_container;
// Give us some basic information
$this->time_now = time();
@@ -402,15 +402,18 @@ class phpbb_session
// Check whether the session is still valid if we have one
$method = basename(trim($config['auth_method']));
- include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
- $method = 'validate_session_' . $method;
- if (function_exists($method))
+ $provider = $phpbb_container->get('auth.provider.' . $method);
+
+ if (!($provider instanceof phpbb_auth_provider_interface))
{
- if (!$method($this->data))
- {
- $session_expired = true;
- }
+ throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_interface');
+ }
+
+ $ret = $provider->validate_session($this->data);
+ if ($ret !== null && !$ret)
+ {
+ $session_expired = true;
}
if (!$session_expired)
@@ -504,7 +507,7 @@ class phpbb_session
*/
function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true)
{
- global $SID, $_SID, $db, $config, $cache, $phpbb_root_path, $phpEx;
+ global $SID, $_SID, $db, $config, $cache, $phpbb_root_path, $phpEx, $phpbb_container;
$this->data = array();
@@ -568,18 +571,14 @@ class phpbb_session
}
$method = basename(trim($config['auth_method']));
- include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
- $method = 'autologin_' . $method;
- if (function_exists($method))
- {
- $this->data = $method();
+ $provider = $phpbb_container->get('auth.provider.' . $method);
+ $this->data = $provider->autologin();
- if (sizeof($this->data))
- {
- $this->cookie_data['k'] = '';
- $this->cookie_data['u'] = $this->data['user_id'];
- }
+ if (sizeof($this->data))
+ {
+ $this->cookie_data['k'] = '';
+ $this->cookie_data['u'] = $this->data['user_id'];
}
// If we're presented with an autologin key we'll join against it.
@@ -884,7 +883,7 @@ class phpbb_session
*/
function session_kill($new_session = true)
{
- global $SID, $_SID, $db, $config, $phpbb_root_path, $phpEx;
+ global $SID, $_SID, $db, $config, $phpbb_root_path, $phpEx, $phpbb_container;
$sql = 'DELETE FROM ' . SESSIONS_TABLE . "
WHERE session_id = '" . $db->sql_escape($this->session_id) . "'
@@ -893,13 +892,9 @@ class phpbb_session
// Allow connecting logout with external auth method logout
$method = basename(trim($config['auth_method']));
- include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
- $method = 'logout_' . $method;
- if (function_exists($method))
- {
- $method($this->data, $new_session);
- }
+ $provider = $phpbb_container->get('auth.provider.' . $method);
+ $provider->logout($this->data, $new_session);
if ($this->data['user_id'] != ANONYMOUS)
{
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 4703c3a219..034f518091 100644
--- a/phpBB/includes/style/style.php
+++ b/phpBB/phpbb/style/style.php
@@ -85,28 +85,62 @@ class phpbb_style
}
/**
- * Set style location based on (current) user's chosen style.
+ * Get the style tree of the style preferred by the current user
+ *
+ * @return array Style tree, most specific first
*/
- public function set_style()
+ public function get_user_style()
{
- $style_path = $this->user->style['style_path'];
- $style_dirs = ($this->user->style['style_parent_id']) ? array_reverse(explode('/', $this->user->style['style_parent_tree'])) : array();
+ $style_list = array(
+ $this->user->style['style_path'],
+ );
- $names = array($style_path);
- foreach ($style_dirs as $dir)
+ if ($this->user->style['style_parent_id'])
{
- $names[] = $dir;
+ $style_list = array_merge($style_list, array_reverse(explode('/', $this->user->style['style_parent_tree'])));
}
- // Add 'all' path, used as last fallback path by events and extensions
- //$names[] = 'all';
+
+ return $style_list;
+ }
+
+ /**
+ * Set style location based on (current) user's chosen style.
+ *
+ * @param array $style_directories The directories to add style paths for
+ * E.g. array('ext/foo/bar/styles', 'styles')
+ * Default: array('styles') (phpBB's style directory)
+ * @return bool true
+ */
+ public function set_style($style_directories = array('styles'))
+ {
+ $this->names = $this->get_user_style();
$paths = array();
- foreach ($names as $name)
+ foreach ($style_directories as $directory)
{
- $paths[] = $this->get_style_path($name);
+ foreach ($this->names as $name)
+ {
+ $path = $this->get_style_path($name, $directory);
+
+ if (is_dir($path))
+ {
+ $paths[] = $path;
+ }
+ }
}
- return $this->set_custom_style($style_path, $paths, $names);
+ $this->provider->set_styles($paths);
+ $this->locator->set_paths($this->provider);
+
+ $new_paths = array();
+ foreach ($paths as $path)
+ {
+ $new_paths[] = $path . '/template/';
+ }
+
+ $this->template->set_style_names($this->names, $new_paths, ($style_directories === array('styles')));
+
+ return true;
}
/**
@@ -118,6 +152,7 @@ class phpbb_style
* @param array or string $paths Array of style paths, relative to current root directory
* @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used.
* @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/).
+ * @return bool true
*/
public function set_custom_style($name, $paths, $names = array(), $template_path = false)
{
@@ -135,18 +170,18 @@ class phpbb_style
$this->provider->set_styles($paths);
$this->locator->set_paths($this->provider);
- $this->template->set_style_names($names);
-
if ($template_path !== false)
{
$this->locator->set_template_path($template_path);
}
- else
+
+ $new_paths = array();
+ foreach ($paths as $path)
{
- $this->locator->set_default_template_path();
+ $new_paths[] = $path . '/' . (($template_path !== false) ? $template_path : 'template/');
}
- $this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_';
+ $this->template->set_style_names($names, $new_paths);
return true;
}
@@ -155,11 +190,14 @@ class phpbb_style
* Get location of style directory for specific style_path
*
* @param string $path Style path, such as "prosilver"
+ * @param string $style_base_directory The base directory the style is in
+ * E.g. 'styles', 'ext/foo/bar/styles'
+ * Default: 'styles'
* @return string Path to style directory, relative to current path
*/
- public function get_style_path($path)
+ public function get_style_path($path, $style_base_directory = 'styles')
{
- return $this->phpbb_root_path . 'styles/' . $path;
+ return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path;
}
/**
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 ec09da1cf3..c5ce7422b9 100644
--- a/phpBB/includes/template/context.php
+++ b/phpBB/phpbb/template/context.php
@@ -138,7 +138,7 @@ class phpbb_template_context
}
$s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0;
- $vararray['S_ROW_COUNT'] = $s_row_count;
+ $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count;
// Assign S_FIRST_ROW
if (!$s_row_count)
@@ -146,6 +146,9 @@ class phpbb_template_context
$vararray['S_FIRST_ROW'] = true;
}
+ // Assign S_BLOCK_NAME
+ $vararray['S_BLOCK_NAME'] = $blocks[$blockcount];
+
// Now the tricky part, we always assign S_LAST_ROW and remove the entry before
// This is much more clever than going through the complete template data on display (phew)
$vararray['S_LAST_ROW'] = true;
@@ -158,12 +161,18 @@ class phpbb_template_context
// We're adding a new iteration to this block with the given
// variable assignments.
$str[$blocks[$blockcount]][] = $vararray;
+
+ // Set S_NUM_ROWS
+ foreach ($str[$blocks[$blockcount]] as &$mod_block)
+ {
+ $mod_block['S_NUM_ROWS'] = sizeof($str[$blocks[$blockcount]]);
+ }
}
else
{
// Top-level block.
$s_row_count = (isset($this->tpldata[$blockname])) ? sizeof($this->tpldata[$blockname]) : 0;
- $vararray['S_ROW_COUNT'] = $s_row_count;
+ $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count;
// Assign S_FIRST_ROW
if (!$s_row_count)
@@ -171,6 +180,9 @@ class phpbb_template_context
$vararray['S_FIRST_ROW'] = true;
}
+ // Assign S_BLOCK_NAME
+ $vararray['S_BLOCK_NAME'] = $blockname;
+
// We always assign S_LAST_ROW and remove the entry before
$vararray['S_LAST_ROW'] = true;
if ($s_row_count > 0)
@@ -180,6 +192,12 @@ class phpbb_template_context
// Add a new iteration to this block with the variable assignments we were given.
$this->tpldata[$blockname][] = $vararray;
+
+ // Set S_NUM_ROWS
+ foreach ($this->tpldata[$blockname] as &$mod_block)
+ {
+ $mod_block['S_NUM_ROWS'] = sizeof($this->tpldata[$blockname]);
+ }
}
return true;
@@ -298,14 +316,26 @@ class phpbb_template_context
$vararray['S_FIRST_ROW'] = true;
}
+ // Assign S_BLOCK_NAME
+ $vararray['S_BLOCK_NAME'] = $blockname;
+
// Re-position template blocks
for ($i = sizeof($block); $i > $key; $i--)
{
$block[$i] = $block[$i-1];
+
+ $block[$i]['S_ROW_COUNT'] = $block[$i]['S_ROW_NUM'] = $i;
}
// Insert vararray at given position
$block[$key] = $vararray;
+ $block[$key]['S_ROW_COUNT'] = $block[$key]['S_ROW_NUM'] = $key;
+
+ // Set S_NUM_ROWS
+ foreach ($this->tpldata[$blockname] as &$mod_block)
+ {
+ $mod_block['S_NUM_ROWS'] = sizeof($this->tpldata[$blockname]);
+ }
return true;
}
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/phpbb/template/template.php b/phpBB/phpbb/template/template.php
new file mode 100644
index 0000000000..89a01e924d
--- /dev/null
+++ b/phpBB/phpbb/template/template.php
@@ -0,0 +1,157 @@
+<?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;
+}
+
+interface phpbb_template
+{
+
+ /**
+ * Clear the cache
+ *
+ * @return phpbb_template
+ */
+ public function clear_cache();
+
+ /**
+ * Sets the template filenames for handles.
+ *
+ * @param array $filename_array Should be a hash of handle => filename pairs.
+ * @return phpbb_template $this
+ */
+ public function set_filenames(array $filename_array);
+
+ /**
+ * Sets the style names/paths corresponding to style hierarchy being compiled
+ * and/or rendered.
+ *
+ * @param array $style_names List of style names in inheritance tree order
+ * @param array $style_paths List of style paths in inheritance tree order
+ * @return phpbb_template $this
+ */
+ public function set_style_names(array $style_names, array $style_paths);
+
+ /**
+ * Clears all variables and blocks assigned to this template.
+ *
+ * @return phpbb_template $this
+ */
+ public function destroy();
+
+ /**
+ * Reset/empty complete block
+ *
+ * @param string $blockname Name of block to destroy
+ * @return phpbb_template $this
+ */
+ public function destroy_block_vars($blockname);
+
+ /**
+ * Display a template for provided handle.
+ *
+ * The template will be loaded and compiled, if necessary, first.
+ *
+ * This function calls hooks.
+ *
+ * @param string $handle Handle to display
+ * @return phpbb_template $this
+ */
+ public function display($handle);
+
+ /**
+ * Display the handle and assign the output to a template variable
+ * or return the compiled result.
+ *
+ * @param string $handle Handle to operate on
+ * @param string $template_var Template variable to assign compiled handle to
+ * @param bool $return_content If true return compiled handle, otherwise assign to $template_var
+ * @return phpbb_template|string if $return_content is true return string of the compiled handle, otherwise return $this
+ */
+ public function assign_display($handle, $template_var = '', $return_content = true);
+
+ /**
+ * Assign key variable pairs from an array
+ *
+ * @param array $vararray A hash of variable name => value pairs
+ * @return phpbb_template $this
+ */
+ public function assign_vars(array $vararray);
+
+ /**
+ * Assign a single scalar value to a single key.
+ *
+ * Value can be a string, an integer or a boolean.
+ *
+ * @param string $varname Variable name
+ * @param string $varval Value to assign to variable
+ * @return phpbb_template $this
+ */
+ public function assign_var($varname, $varval);
+
+ /**
+ * Append text to the string value stored in a key.
+ *
+ * Text is appended using the string concatenation operator (.).
+ *
+ * @param string $varname Variable name
+ * @param string $varval Value to append to variable
+ * @return phpbb_template $this
+ */
+ public function append_var($varname, $varval);
+
+ /**
+ * Assign key variable pairs from an array to a specified block
+ * @param string $blockname Name of block to assign $vararray to
+ * @param array $vararray A hash of variable name => value pairs
+ * @return phpbb_template $this
+ */
+ public function assign_block_vars($blockname, array $vararray);
+
+ /**
+ * Change already assigned key variable pair (one-dimensional - single loop entry)
+ *
+ * An example of how to use this function:
+ * {@example alter_block_array.php}
+ *
+ * @param string $blockname the blockname, for example 'loop'
+ * @param array $vararray the var array to insert/add or merge
+ * @param mixed $key Key to search for
+ *
+ * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
+ *
+ * int: Position [the position to change or insert at directly given]
+ *
+ * If key is false the position is set to 0
+ * If key is true the position is set to the last entry
+ *
+ * @param string $mode Mode to execute (valid modes are 'insert' and 'change')
+ *
+ * If insert, the vararray is inserted at the given position (position counting from zero).
+ * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
+ *
+ * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
+ * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
+ *
+ * @return bool false on error, true on success
+ */
+ public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert');
+
+ /**
+ * Get path to template for handle (required for BBCode parser)
+ *
+ * @return string
+ */
+ public function get_source_file_for_handle($handle);
+}
diff --git a/phpBB/phpbb/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php
new file mode 100644
index 0000000000..6557b209eb
--- /dev/null
+++ b/phpBB/phpbb/template/twig/definition.php
@@ -0,0 +1,69 @@
+<?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;
+}
+
+/**
+* This class holds all DEFINE variables from the current page load
+*/
+class phpbb_template_twig_definition
+{
+ /** @var array **/
+ protected $definitions = array();
+
+ /**
+ * Get a DEFINE'd variable
+ *
+ * @param string $name
+ * @return mixed Null if not found
+ */
+ public function __call($name, $arguments)
+ {
+ return (isset($this->definitions[$name])) ? $this->definitions[$name] : null;
+ }
+
+ /**
+ * DEFINE a variable
+ *
+ * @param string $name
+ * @param mixed $value
+ * @return phpbb_template_twig_definition
+ */
+ public function set($name, $value)
+ {
+ $this->definitions[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Append to a variable
+ *
+ * @param string $name
+ * @param string $value
+ * @return phpbb_template_twig_definition
+ */
+ public function append($name, $value)
+ {
+ if (!isset($this->definitions[$name]))
+ {
+ $this->definitions[$name] = '';
+ }
+
+ $this->definitions[$name] .= $value;
+
+ return $this;
+ }
+}
diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php
new file mode 100644
index 0000000000..b60cd72325
--- /dev/null
+++ b/phpBB/phpbb/template/twig/environment.php
@@ -0,0 +1,140 @@
+<?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_twig_environment extends Twig_Environment
+{
+ /** @var array */
+ protected $phpbb_extensions;
+
+ /** @var phpbb_config */
+ protected $phpbb_config;
+
+ /** @var string */
+ protected $phpbb_root_path;
+
+ /** @var array **/
+ protected $namespace_look_up_order = array('__main__');
+
+ /**
+ * Constructor
+ *
+ * @param phpbb_config $phpbb_config
+ * @param array $phpbb_extensions Array of enabled extensions (name => path)
+ * @param string $phpbb_root_path
+ * @param Twig_LoaderInterface $loader
+ * @param array $options Array of options to pass to Twig
+ */
+ public function __construct($phpbb_config, $phpbb_extensions, $phpbb_root_path, Twig_LoaderInterface $loader = null, $options = array())
+ {
+ $this->phpbb_config = $phpbb_config;
+ $this->phpbb_extensions = $phpbb_extensions;
+ $this->phpbb_root_path = $phpbb_root_path;
+
+ return parent::__construct($loader, $options);
+ }
+
+ /**
+ * Get the list of enabled phpBB extensions
+ *
+ * Used in EVENT node
+ *
+ * @return array
+ */
+ public function get_phpbb_extensions()
+ {
+ return $this->phpbb_extensions;
+ }
+
+ /**
+ * Get phpBB config
+ *
+ * @return phpbb_config
+ */
+ public function get_phpbb_config()
+ {
+ return $this->phpbb_config;
+ }
+
+ /**
+ * Get the phpBB root path
+ *
+ * @return string
+ */
+ public function get_phpbb_root_path()
+ {
+ return $this->phpbb_root_path;
+ }
+
+ /**
+ * Get the namespace look up order
+ *
+ * @return array
+ */
+ public function getNamespaceLookUpOrder()
+ {
+ return $this->namespace_look_up_order;
+ }
+
+ /**
+ * Set the namespace look up order to load templates from
+ *
+ * @param array $namespace
+ * @return Twig_Environment
+ */
+ public function setNamespaceLookUpOrder($namespace)
+ {
+ $this->namespace_look_up_order = $namespace;
+
+ return $this;
+ }
+
+ /**
+ * Loads a template by name.
+ *
+ * @param string $name The template name
+ * @param integer $index The index if it is an embedded template
+ * @return Twig_TemplateInterface A template instance representing the given template name
+ */
+ public function loadTemplate($name, $index = null)
+ {
+ if (strpos($name, '@') === false)
+ {
+ foreach ($this->getNamespaceLookUpOrder() as $namespace)
+ {
+ try
+ {
+ if ($namespace === '__main__')
+ {
+ return parent::loadTemplate($name, $index);
+ }
+
+ return parent::loadTemplate('@' . $namespace . '/' . $name, $index);
+ }
+ catch (Twig_Error_Loader $e)
+ {
+ }
+ }
+
+ // We were unable to load any templates
+ throw $e;
+ }
+ else
+ {
+ return parent::loadTemplate($name, $index);
+ }
+ }
+}
diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php
new file mode 100644
index 0000000000..c279726434
--- /dev/null
+++ b/phpBB/phpbb/template/twig/extension.php
@@ -0,0 +1,188 @@
+<?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_twig_extension extends Twig_Extension
+{
+ /** @var phpbb_template_context */
+ protected $context;
+
+ /** @var phpbb_user */
+ protected $user;
+
+ /**
+ * Constructor
+ *
+ * @param phpbb_template_context $context
+ * @param phpbb_user $user
+ * @return phpbb_template_twig_extension
+ */
+ public function __construct(phpbb_template_context $context, $user)
+ {
+ $this->context = $context;
+ $this->user = $user;
+ }
+
+ /**
+ * Get the name of this extension
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return 'phpbb';
+ }
+
+ /**
+ * Returns the token parser instance to add to the existing list.
+ *
+ * @return array An array of Twig_TokenParser instances
+ */
+ public function getTokenParsers()
+ {
+ return array(
+ new phpbb_template_twig_tokenparser_define,
+ new phpbb_template_twig_tokenparser_include,
+ new phpbb_template_twig_tokenparser_includejs,
+ new phpbb_template_twig_tokenparser_includecss,
+ new phpbb_template_twig_tokenparser_event,
+ new phpbb_template_twig_tokenparser_includephp,
+ new phpbb_template_twig_tokenparser_php,
+ );
+ }
+
+ /**
+ * Returns a list of filters to add to the existing list.
+ *
+ * @return array An array of filters
+ */
+ public function getFilters()
+ {
+ return array(
+ new Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)),
+ new Twig_SimpleFilter('addslashes', 'addslashes'),
+ );
+ }
+
+ /**
+ * Returns a list of global functions to add to the existing list.
+ *
+ * @return array An array of global functions
+ */
+ public function getFunctions()
+ {
+ return array(
+ new Twig_SimpleFunction('lang', array($this, 'lang')),
+ );
+ }
+
+ /**
+ * Returns a list of operators to add to the existing list.
+ *
+ * @return array An array of operators
+ */
+ public function getOperators()
+ {
+ return array(
+ array(
+ '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'),
+ ),
+ array(
+ // precedence settings are copied from similar operators in Twig core extension
+ '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+
+ 'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+
+ 'ne' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'neq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ '<>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+
+ '===' => array('precedence' => 20, 'class' => 'phpbb_template_twig_node_expression_binary_equalequal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ '!==' => array('precedence' => 20, 'class' => 'phpbb_template_twig_node_expression_binary_notequalequal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+
+ 'gt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'gte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'ge' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'lt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+
+ 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ ),
+ );
+ }
+
+ /**
+ * Grabs a subset of a loop
+ *
+ * @param Twig_Environment $env A Twig_Environment instance
+ * @param mixed $item A variable
+ * @param integer $start Start of the subset
+ * @param integer $end End of the subset
+ * @param Boolean $preserveKeys Whether to preserve key or not (when the input is an array)
+ *
+ * @return mixed The sliced variable
+ */
+ function loop_subset(Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false)
+ {
+ // We do almost the same thing as Twig's slice (array_slice), except when $end is positive
+ if ($end >= 1)
+ {
+ // When end is > 1, subset will end on the last item in an array with the specified $end
+ // This is different from slice in that it is the number we end on rather than the number
+ // of items to grab (length)
+
+ // Start must always be the actual starting number for this calculation (not negative)
+ $start = ($start < 0) ? sizeof($item) + $start : $start;
+ $end = $end - $start;
+ }
+
+ // We always include the last element (this was the past design)
+ $end = ($end == -1 || $end === null) ? null : $end + 1;
+
+ return twig_slice($env, $item, $start, $end, $preserveKeys);
+ }
+
+ /**
+ * Get output for a language variable (L_FOO, LA_FOO)
+ *
+ * This function checks to see if the language var was outputted to $context
+ * (e.g. in the ACP, L_TITLE)
+ * If not, we return the result of $user->lang()
+ *
+ * @param string $lang name
+ * @return string
+ */
+ function lang()
+ {
+ $args = func_get_args();
+ $key = $args[0];
+
+ $context = $this->context->get_data_ref();
+ $context_vars = $context['.'][0];
+
+ if (isset($context_vars['L_' . $key]))
+ {
+ return $context_vars['L_' . $key];
+ }
+
+ // LA_ is transformed into lang(\'$1\')|addslashes, so we should not
+ // need to check for it
+
+ return call_user_func_array(array($this->user, 'lang'), $args);
+ }
+}
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
new file mode 100644
index 0000000000..46412ad048
--- /dev/null
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -0,0 +1,300 @@
+<?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_twig_lexer extends Twig_Lexer
+{
+ public function tokenize($code, $filename = null)
+ {
+ // Our phpBB tags
+ // Commented out tokens are handled separately from the main replace
+ $phpbb_tags = array(
+ /*'BEGIN',
+ 'BEGINELSE',
+ 'END',
+ 'IF',
+ 'ELSE',
+ 'ELSEIF',
+ 'ENDIF',
+ 'DEFINE',
+ 'UNDEFINE',*/
+ 'ENDDEFINE',
+ 'INCLUDE',
+ 'INCLUDEPHP',
+ 'INCLUDEJS',
+ 'INCLUDECSS',
+ 'PHP',
+ 'ENDPHP',
+ 'EVENT',
+ );
+
+ // Twig tag masks
+ $twig_tags = array(
+ 'autoescape',
+ 'endautoescape',
+ 'if',
+ 'elseif',
+ 'else',
+ 'endif',
+ 'block',
+ 'endblock',
+ 'use',
+ 'extends',
+ 'embed',
+ 'filter',
+ 'endfilter',
+ 'flush',
+ 'for',
+ 'endfor',
+ 'macro',
+ 'endmacro',
+ 'import',
+ 'from',
+ 'sandbox',
+ 'endsandbox',
+ 'set',
+ 'endset',
+ 'spaceless',
+ 'endspaceless',
+ 'verbatim',
+ 'endverbatim',
+ );
+
+ // Fix tokens that may have inline variables (e.g. <!-- DEFINE $TEST = '{FOO}')
+ $code = $this->fix_inline_variable_tokens(array(
+ 'DEFINE.+=',
+ 'INCLUDE',
+ 'INCLUDEPHP',
+ 'INCLUDEJS',
+ 'INCLUDECSS',
+ ), $code);
+
+ // Fix our BEGIN statements
+ $code = $this->fix_begin_tokens($code);
+
+ // Fix our IF tokens
+ $code = $this->fix_if_tokens($code);
+
+ // Fix our DEFINE tokens
+ $code = $this->fix_define_tokens($code);
+
+ // Replace all of our starting tokens, <!-- TOKEN --> with Twig style, {% TOKEN %}
+ // This also strips outer parenthesis, <!-- IF (blah) --> becomes <!-- IF blah -->
+ $code = preg_replace('#<!-- (' . implode('|', $phpbb_tags) . ')(?: (.*?) ?)?-->#', '{% $1 $2 %}', $code);
+
+ // Replace all of our twig masks with Twig code (e.g. <!-- BLOCK .+ --> with {% block $1 %})
+ $code = $this->replace_twig_tag_masks($code, $twig_tags);
+
+ // Replace all of our language variables, {L_VARNAME}, with Twig style, {{ lang('NAME') }}
+ // Appends any filters after lang()
+ $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2 }}', $code);
+
+ // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|addslashes }}
+ // Appends any filters after lang(), but before addslashes
+ $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|addslashes }}', $code);
+
+ // Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }}
+ // Appends any filters
+ $code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ $1$2 }}', $code);
+
+ return parent::tokenize($code, $filename);
+ }
+
+ /**
+ * Fix tokens that may have inline variables
+ *
+ * E.g. <!-- INCLUDE {TEST}.html
+ *
+ * @param array $tokens array of tokens to search for (imploded to a regular expression)
+ * @param string $code
+ * @return string
+ */
+ protected function fix_inline_variable_tokens($tokens, $code)
+ {
+ $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]);
+
+ // Surround the matches in single quotes ('' ~ TEST ~ '.html')
+ return "<!-- {$matches[1]} '{$matches[2]}' -->";
+ };
+
+ return preg_replace_callback('#<!-- (' . implode('|', $tokens) . ') (.+?) -->#', $callback, $code);
+ }
+
+ /**
+ * Fix begin tokens (convert our BEGIN to Twig for)
+ *
+ * Not meant to be used outside of this context, public because the anonymous function calls this
+ *
+ * @param string $code
+ * @param array $parent_nodes (used in recursion)
+ * @return string
+ */
+ public function fix_begin_tokens($code, $parent_nodes = array())
+ {
+ // PHP 5.3 cannot use $this in an anonymous function, so use this as a work-around
+ $parent_class = $this;
+ $callback = function ($matches) use ($parent_class, $parent_nodes)
+ {
+ $name = $matches[1];
+ $subset = trim(substr($matches[2], 1, -1)); // Remove parenthesis
+ $body = $matches[3];
+
+ // Is the designer wanting to call another loop in a loop?
+ // <!-- BEGIN loop -->
+ // <!-- BEGIN !loop2 -->
+ // <!-- END !loop2 -->
+ // <!-- END loop -->
+ // 'loop2' is actually on the same nesting level as 'loop' you assign
+ // variables to it with template->assign_block_vars('loop2', array(...))
+ if (strpos($name, '!') === 0)
+ {
+ // Count the number if ! occurrences
+ $count = substr_count($name, '!');
+ for ($i = 0; $i < $count; $i++)
+ {
+ array_pop($parent_nodes);
+ $name = substr($name, 1);
+ }
+ }
+
+ // Remove all parent nodes, e.g. foo, bar from foo.bar.foobar.VAR
+ foreach ($parent_nodes as $node)
+ {
+ $body = preg_replace('#([^a-zA-Z0-9_])' . $node . '\.([a-zA-Z0-9_]+)\.#', '$1$2.', $body);
+ }
+
+ // Add current node to list of parent nodes for child nodes
+ $parent_nodes[] = $name;
+
+ // Recursive...fix any child nodes
+ $body = $parent_class->fix_begin_tokens($body, $parent_nodes);
+
+ // Rename loopname vars (to prevent collisions, loop children are named (loop name)_loop_element)
+ $body = str_replace($name . '.', $name . '_loop_element.', $body);
+
+ // Need the parent variable name
+ array_pop($parent_nodes);
+ $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '_loop_element.' : '';
+
+ if ($subset !== '')
+ {
+ $subset = '|subset(' . $subset . ')';
+ }
+
+ // Turn into a Twig for loop, using (loop name)_loop_element for each child
+ return "{% for {$name}_loop_element in {$parent}{$name}{$subset} %}{$body}{% endfor %}";
+ };
+
+ // Replace <!-- BEGINELSE --> correctly, only needs to be done once
+ $code = str_replace('<!-- BEGINELSE -->', '{% else %}', $code);
+
+ return preg_replace_callback('#<!-- BEGIN ([!a-zA-Z0-9_]+)(\([0-9,\-]+\))? -->(.+?)<!-- END \1 -->#s', $callback, $code);
+ }
+
+ /**
+ * Fix IF statements
+ *
+ * @param string $code
+ * @return string
+ */
+ protected function fix_if_tokens($code)
+ {
+ $callback = function($matches)
+ {
+ // Replace $TEST with definition.TEST
+ $matches[1] = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $matches[1]);
+
+ // Replace .test with test|length
+ $matches[1] = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $matches[1]);
+
+ return '<!-- IF' . $matches[1] . '-->';
+ };
+
+ // 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);
+ }
+
+ /**
+ * Fix DEFINE statements and {$VARNAME} variables
+ *
+ * @param string $code
+ * @return string
+ */
+ protected function fix_define_tokens($code)
+ {
+ /**
+ * Changing $VARNAME to definition.varname because set is only local
+ * context (e.g. DEFINE $TEST will only make $TEST available in current
+ * template and any child templates, but not any parent templates).
+ *
+ * DEFINE handles setting it properly to definition in its node, but the
+ * variables reading FROM it need to be altered to definition.VARNAME
+ *
+ * Setting up definition as a class in the array passed to Twig
+ * ($context) makes set definition.TEST available in the global context
+ */
+
+ // Replace <!-- DEFINE $NAME with {% DEFINE definition.NAME
+ $code = preg_replace('#<!-- DEFINE \$(.*)-->#', '{% DEFINE $1 %}', $code);
+
+ // Changing UNDEFINE NAME to DEFINE NAME = null to save from creating an extra token parser/node
+ $code = preg_replace('#<!-- UNDEFINE \$(.*)-->#', '{% DEFINE $1= null %}', $code);
+
+ // Replace all of our variables, {$VARNAME}, with Twig style, {{ definition.VARNAME }}
+ $code = preg_replace('#{\$([a-zA-Z0-9_\.]+)}#', '{{ definition.$1 }}', $code);
+
+ // Replace all of our variables, ~ $VARNAME ~, with Twig style, ~ definition.VARNAME ~
+ $code = preg_replace('#~ \$([a-zA-Z0-9_\.]+) ~#', '~ definition.$1 ~', $code);
+
+ return $code;
+ }
+
+ /**
+ * Replace Twig tag masks with Twig tag calls
+ *
+ * E.g. <!-- BLOCK foo --> with {% block foo %}
+ *
+ * @param string $code
+ * @param array $twig_tags All tags we want to create a mask for
+ * @return string
+ */
+ protected function replace_twig_tag_masks($code, $twig_tags)
+ {
+ $callback = function ($matches)
+ {
+ $matches[1] = strtolower($matches[1]);
+
+ return "{% {$matches[1]}{$matches[2]}%}";
+ };
+
+ foreach ($twig_tags as &$tag)
+ {
+ $tag = strtoupper($tag);
+ }
+
+ // twig_tags is an array of the twig tags, which are all lowercase, but we use all uppercase tags
+ $code = preg_replace_callback('#<!-- (' . implode('|', $twig_tags) . ')(.*?)-->#',$callback, $code);
+
+ return $code;
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/define.php b/phpBB/phpbb/template/twig/node/define.php
new file mode 100644
index 0000000000..fcb19cc773
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/define.php
@@ -0,0 +1,58 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier, Armin Ronacher
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+
+class phpbb_template_twig_node_define extends Twig_Node
+{
+ public function __construct($capture, Twig_NodeInterface $name, Twig_NodeInterface $value, $lineno, $tag = null)
+ {
+ parent::__construct(array('name' => $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag);
+ }
+
+ /**
+ * Compiles the node to PHP.
+ *
+ * @param Twig_Compiler A Twig_Compiler instance
+ */
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->addDebugInfo($this);
+
+ if ($this->getAttribute('capture')) {
+ $compiler
+ ->write("ob_start();\n")
+ ->subcompile($this->getNode('value'))
+ ;
+
+ $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new Twig_Markup(\$value, \$this->env->getCharset());\n");
+ }
+ else
+ {
+ $compiler
+ ->write("\$value = ")
+ ->subcompile($this->getNode('value'))
+ ->raw(";\n")
+ ;
+ }
+
+ $compiler
+ ->write("\$context['definition']->set('")
+ ->raw($this->getNode('name')->getAttribute('name'))
+ ->raw("', \$value);\n")
+ ;
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php
new file mode 100644
index 0000000000..971dea14fa
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/event.php
@@ -0,0 +1,79 @@
+<?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_twig_node_event extends Twig_Node
+{
+ /** @var Twig_Environment */
+ protected $environment;
+
+ public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null)
+ {
+ $this->environment = $environment;
+
+ parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
+ }
+
+ /**
+ * Compiles the node to PHP.
+ *
+ * @param Twig_Compiler A Twig_Compiler instance
+ */
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->addDebugInfo($this);
+
+ $location = $this->getNode('expr')->getAttribute('name');
+
+ foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path)
+ {
+ $ext_namespace = str_replace('/', '_', $ext_namespace);
+
+ if (defined('DEBUG'))
+ {
+ // If debug mode is enabled, lets check for new/removed EVENT
+ // templates on page load rather than at compile. This is
+ // slower, but makes developing extensions easier (no need to
+ // purge the cache when a new event template file is added)
+ $compiler
+ ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n")
+ ->indent()
+ ;
+ }
+
+ if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html'))
+ {
+ $compiler
+ ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n")
+
+ // We set the namespace lookup order to be this extension first, then the main path
+ ->write("\$this->env->setNamespaceLookUpOrder(array('{$ext_namespace}', '__main__'));\n")
+ ->write("\$this->env->loadTemplate('@{$ext_namespace}/{$location}.html')->display(\$context);\n")
+ ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n")
+ ;
+ }
+
+ if (defined('DEBUG'))
+ {
+ $compiler
+ ->outdent()
+ ->write("}\n\n")
+ ;
+ }
+ }
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
new file mode 100644
index 0000000000..8ec2069114
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
@@ -0,0 +1,25 @@
+<?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_twig_node_expression_binary_equalequal extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('===');
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
new file mode 100644
index 0000000000..96f32c502e
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
@@ -0,0 +1,25 @@
+<?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_twig_node_expression_binary_notequalequal extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('!==');
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/include.php b/phpBB/phpbb/template/twig/node/include.php
new file mode 100644
index 0000000000..5c6ae1bbcf
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/include.php
@@ -0,0 +1,56 @@
+<?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_twig_node_include extends Twig_Node_Include
+{
+ /**
+ * Compiles the node to PHP.
+ *
+ * @param Twig_Compiler A Twig_Compiler instance
+ */
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->addDebugInfo($this);
+
+ $compiler
+ ->write("\$location = ")
+ ->subcompile($this->getNode('expr'))
+ ->raw(";\n")
+ ->write("\$namespace = false;\n")
+ ->write("if (strpos(\$location, '@') === 0) {\n")
+ ->indent()
+ ->write("\$namespace = substr(\$location, 1, strpos(\$location, '/') - 1);\n")
+ ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n")
+
+ // We set the namespace lookup order to be this namespace first, then the main path
+ ->write("\$this->env->setNamespaceLookUpOrder(array(\$namespace, '__main__'));\n")
+ ->outdent()
+ ->write("}\n")
+ ;
+
+ parent::compile($compiler);
+
+ $compiler
+ ->write("if (\$namespace) {\n")
+ ->indent()
+ ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n")
+ ->outdent()
+ ->write("}\n")
+ ;
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php
new file mode 100644
index 0000000000..990b1c984f
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/includeasset.php
@@ -0,0 +1,60 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_template_twig_node_includeasset extends Twig_Node
+{
+ /** @var Twig_Environment */
+ protected $environment;
+
+ public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null)
+ {
+ $this->environment = $environment;
+
+ parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
+ }
+ /**
+ * Compiles the node to PHP.
+ *
+ * @param Twig_Compiler A Twig_Compiler instance
+ */
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->addDebugInfo($this);
+
+ $config = $this->environment->get_phpbb_config();
+
+ $compiler
+ ->write("\$asset_file = ")
+ ->subcompile($this->getNode('expr'))
+ ->raw(";\n")
+ ->write("\$asset = new phpbb_template_asset(\$asset_file);\n")
+ ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n")
+ ->indent()
+ ->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("\$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("\$context['definition']->append('{$this->get_definition_name()}', '")
+ ;
+
+ $this->append_asset($compiler);
+
+ $compiler
+ ->raw("\n');\n")
+ ;
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php
new file mode 100644
index 0000000000..01fda44aad
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/includecss.php
@@ -0,0 +1,30 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_includeasset
+{
+ public function get_definition_name()
+ {
+ return 'STYLESHEETS';
+ }
+
+ /**
+ * Compiles the node to PHP.
+ *
+ * @param Twig_Compiler A Twig_Compiler instance
+ */
+ public function append_asset(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw("<link href=\"' . ")
+ ->raw("\$asset_file . '\"")
+ ->raw(' rel="stylesheet" type="text/css" media="screen, projection" />')
+ ;
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php
new file mode 100644
index 0000000000..fdf2bea3ed
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/includejs.php
@@ -0,0 +1,32 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_template_twig_node_includejs extends phpbb_template_twig_node_includeasset
+{
+ public function get_definition_name()
+ {
+ return 'SCRIPTS';
+ }
+
+ /**
+ * Compiles the node to PHP.
+ *
+ * @param Twig_Compiler A Twig_Compiler instance
+ */
+ protected function append_asset(Twig_Compiler $compiler)
+ {
+ $config = $this->environment->get_phpbb_config();
+
+ $compiler
+ ->raw("<script type=\"text/javascript\" src=\"' . ")
+ ->raw("\$asset_file")
+ ->raw(". '\"></script>\n")
+ ;
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php
new file mode 100644
index 0000000000..dbe54f0e1a
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/includephp.php
@@ -0,0 +1,91 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier, Armin Ronacher
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+
+class phpbb_template_twig_node_includephp extends Twig_Node
+{
+ /** @var Twig_Environment */
+ protected $environment;
+
+ public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $ignoreMissing = false, $lineno, $tag = null)
+ {
+ $this->environment = $environment;
+
+ parent::__construct(array('expr' => $expr), array('ignore_missing' => (Boolean) $ignoreMissing), $lineno, $tag);
+ }
+
+ /**
+ * Compiles the node to PHP.
+ *
+ * @param Twig_Compiler A Twig_Compiler instance
+ */
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->addDebugInfo($this);
+
+ $config = $this->environment->get_phpbb_config();
+
+ if (!$config['tpl_allow_php'])
+ {
+ $compiler
+ ->write("// INCLUDEPHP Disabled\n")
+ ;
+
+ return;
+ }
+
+ if ($this->getAttribute('ignore_missing')) {
+ $compiler
+ ->write("try {\n")
+ ->indent()
+ ;
+ }
+
+ $compiler
+ ->write("\$location = ")
+ ->subcompile($this->getNode('expr'))
+ ->raw(";\n")
+ ->write("if (phpbb_is_absolute(\$location)) {\n")
+ ->indent()
+ // Absolute path specified
+ ->write("require(\$location);\n")
+ ->outdent()
+ ->write("} else if (file_exists(\$this->getEnvironment()->get_phpbb_root_path() . \$location)) {\n")
+ ->indent()
+ // PHP file relative to phpbb_root_path
+ ->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n")
+ ->outdent()
+ ->write("} else {\n")
+ ->indent()
+ // Local path (behaves like INCLUDE)
+ ->write("require(\$this->getEnvironment()->getLoader()->getCacheKey(\$location));\n")
+ ->outdent()
+ ->write("}\n")
+ ;
+
+ if ($this->getAttribute('ignore_missing')) {
+ $compiler
+ ->outdent()
+ ->write("} catch (Twig_Error_Loader \$e) {\n")
+ ->indent()
+ ->write("// ignore missing template\n")
+ ->outdent()
+ ->write("}\n\n")
+ ;
+ }
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php
new file mode 100644
index 0000000000..c11539ea7f
--- /dev/null
+++ b/phpBB/phpbb/template/twig/node/php.php
@@ -0,0 +1,55 @@
+<?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_twig_node_php extends Twig_Node
+{
+ /** @var Twig_Environment */
+ protected $environment;
+
+ public function __construct(Twig_Node_Text $text, phpbb_template_twig_environment $environment, $lineno, $tag = null)
+ {
+ $this->environment = $environment;
+
+ parent::__construct(array('text' => $text), array(), $lineno, $tag);
+ }
+
+ /**
+ * Compiles the node to PHP.
+ *
+ * @param Twig_Compiler A Twig_Compiler instance
+ */
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->addDebugInfo($this);
+
+ $config = $this->environment->get_phpbb_config();
+
+ if (!$config['tpl_allow_php'])
+ {
+ $compiler
+ ->write("// PHP Disabled\n")
+ ;
+
+ return;
+ }
+
+ $compiler
+ ->raw($this->getNode('text')->getAttribute('data'))
+ ;
+ }
+}
diff --git a/phpBB/phpbb/template/twig/tokenparser/define.php b/phpBB/phpbb/template/twig/tokenparser/define.php
new file mode 100644
index 0000000000..4ea15388c4
--- /dev/null
+++ b/phpBB/phpbb/template/twig/tokenparser/define.php
@@ -0,0 +1,66 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+
+class phpbb_template_twig_tokenparser_define extends Twig_TokenParser
+{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
+ public function parse(Twig_Token $token)
+ {
+ $lineno = $token->getLine();
+ $stream = $this->parser->getStream();
+ $name = $this->parser->getExpressionParser()->parseExpression();
+
+ $capture = false;
+ if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) {
+ $stream->next();
+ $value = $this->parser->getExpressionParser()->parseExpression();
+
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ } else {
+ $capture = true;
+
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
+
+ $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ }
+
+ return new phpbb_template_twig_node_define($capture, $name, $value, $lineno, $this->getTag());
+ }
+
+ public function decideBlockEnd(Twig_Token $token)
+ {
+ return $token->test('ENDDEFINE');
+ }
+
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @return string The tag name
+ */
+ public function getTag()
+ {
+ return 'DEFINE';
+ }
+}
diff --git a/phpBB/phpbb/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php
new file mode 100644
index 0000000000..e4dddd6dcc
--- /dev/null
+++ b/phpBB/phpbb/template/twig/tokenparser/event.php
@@ -0,0 +1,47 @@
+<?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_twig_tokenparser_event extends Twig_TokenParser
+{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
+ public function parse(Twig_Token $token)
+ {
+ $expr = $this->parser->getExpressionParser()->parseExpression();
+
+ $stream = $this->parser->getStream();
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
+
+ return new phpbb_template_twig_node_event($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
+ }
+
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @return string The tag name
+ */
+ public function getTag()
+ {
+ return 'EVENT';
+ }
+}
diff --git a/phpBB/phpbb/template/twig/tokenparser/include.php b/phpBB/phpbb/template/twig/tokenparser/include.php
new file mode 100644
index 0000000000..520f9fd1a0
--- /dev/null
+++ b/phpBB/phpbb/template/twig/tokenparser/include.php
@@ -0,0 +1,46 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+
+class phpbb_template_twig_tokenparser_include extends Twig_TokenParser_Include
+{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
+ public function parse(Twig_Token $token)
+ {
+ $expr = $this->parser->getExpressionParser()->parseExpression();
+
+ list($variables, $only, $ignoreMissing) = $this->parseArguments();
+
+ return new phpbb_template_twig_node_include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
+ }
+
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @return string The tag name
+ */
+ public function getTag()
+ {
+ return 'INCLUDE';
+ }
+}
diff --git a/phpBB/phpbb/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php
new file mode 100644
index 0000000000..6c24dda647
--- /dev/null
+++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php
@@ -0,0 +1,38 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_template_twig_tokenparser_includecss extends Twig_TokenParser
+{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
+ public function parse(Twig_Token $token)
+ {
+ $expr = $this->parser->getExpressionParser()->parseExpression();
+
+ $stream = $this->parser->getStream();
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
+
+ return new phpbb_template_twig_node_includecss($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
+ }
+
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @return string The tag name
+ */
+ public function getTag()
+ {
+ return 'INCLUDECSS';
+ }
+}
diff --git a/phpBB/phpbb/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php
new file mode 100644
index 0000000000..b02b2f89ba
--- /dev/null
+++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php
@@ -0,0 +1,47 @@
+<?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_twig_tokenparser_includejs extends Twig_TokenParser
+{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
+ public function parse(Twig_Token $token)
+ {
+ $expr = $this->parser->getExpressionParser()->parseExpression();
+
+ $stream = $this->parser->getStream();
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
+
+ return new phpbb_template_twig_node_includejs($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
+ }
+
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @return string The tag name
+ */
+ public function getTag()
+ {
+ return 'INCLUDEJS';
+ }
+}
diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php
new file mode 100644
index 0000000000..13fe6de8a6
--- /dev/null
+++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php
@@ -0,0 +1,56 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group, sections (c) 2009 Fabien Potencier, Armin Ronacher
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+
+class phpbb_template_twig_tokenparser_includephp extends Twig_TokenParser
+{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
+ public function parse(Twig_Token $token)
+ {
+ $expr = $this->parser->getExpressionParser()->parseExpression();
+
+ $stream = $this->parser->getStream();
+
+ $ignoreMissing = false;
+ if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) {
+ $stream->next();
+ $stream->expect(Twig_Token::NAME_TYPE, 'missing');
+
+ $ignoreMissing = true;
+ }
+
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
+
+ return new phpbb_template_twig_node_includephp($expr, $this->parser->getEnvironment(), $ignoreMissing, $token->getLine(), $this->getTag());
+ }
+
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @return string The tag name
+ */
+ public function getTag()
+ {
+ return 'INCLUDEPHP';
+ }
+}
diff --git a/phpBB/phpbb/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php
new file mode 100644
index 0000000000..197980a59a
--- /dev/null
+++ b/phpBB/phpbb/template/twig/tokenparser/php.php
@@ -0,0 +1,55 @@
+<?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_twig_tokenparser_php extends Twig_TokenParser
+{
+ /**
+ * Parses a token and returns a node.
+ *
+ * @param Twig_Token $token A Twig_Token instance
+ *
+ * @return Twig_NodeInterface A Twig_NodeInterface instance
+ */
+ public function parse(Twig_Token $token)
+ {
+ $stream = $this->parser->getStream();
+
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
+
+ $body = $this->parser->subparse(array($this, 'decideEnd'), true);
+
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
+
+ return new phpbb_template_twig_node_php($body, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
+ }
+
+ public function decideEnd(Twig_Token $token)
+ {
+ return $token->test('ENDPHP');
+ }
+
+ /**
+ * Gets the tag name associated with this token parser.
+ *
+ * @return string The tag name
+ */
+ public function getTag()
+ {
+ return 'PHP';
+ }
+}
diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php
new file mode 100644
index 0000000000..92a37d1634
--- /dev/null
+++ b/phpBB/phpbb/template/twig/twig.php
@@ -0,0 +1,465 @@
+<?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;
+}
+
+/**
+* Twig Template class.
+* @package phpBB3
+*/
+class phpbb_template_twig implements phpbb_template
+{
+ /**
+ * Template context.
+ * Stores template data used during template rendering.
+ * @var phpbb_template_context
+ */
+ protected $context;
+
+ /**
+ * Path of the cache directory for the template
+ *
+ * Cannot be changed during runtime.
+ *
+ * @var string
+ */
+ private $cachepath = '';
+
+ /**
+ * phpBB root path
+ * @var string
+ */
+ protected $phpbb_root_path;
+
+ /**
+ * adm relative path
+ * @var string
+ */
+ protected $adm_relative_path;
+
+ /**
+ * PHP file extension
+ * @var string
+ */
+ protected $php_ext;
+
+ /**
+ * phpBB config instance
+ * @var phpbb_config
+ */
+ protected $config;
+
+ /**
+ * Current user
+ * @var phpbb_user
+ */
+ protected $user;
+
+ /**
+ * Extension manager.
+ *
+ * @var phpbb_extension_manager
+ */
+ protected $extension_manager;
+
+ /**
+ * Name of the style that the template being compiled and/or rendered
+ * belongs to, and its parents, in inheritance tree order.
+ *
+ * Used to invoke style-specific template events.
+ *
+ * @var array
+ */
+ protected $style_names;
+
+ /**
+ * Twig Environment
+ *
+ * @var Twig_Environment
+ */
+ protected $twig;
+
+ /**
+ * Array of filenames assigned to set_filenames
+ *
+ * @var array
+ */
+ protected $filenames = array();
+
+ /**
+ * Constructor.
+ *
+ * @param string $phpbb_root_path phpBB root path
+ * @param string $php_ext php extension (typically 'php')
+ * @param phpbb_config $config
+ * @param phpbb_user $user
+ * @param phpbb_template_context $context template context
+ * @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked
+ * @param string $adm_relative_path relative path to adm directory
+ */
+ public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null, $adm_relative_path = null)
+ {
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->adm_relative_path = $adm_relative_path;
+ $this->php_ext = $php_ext;
+ $this->config = $config;
+ $this->user = $user;
+ $this->context = $context;
+ $this->extension_manager = $extension_manager;
+
+ $this->cachepath = $phpbb_root_path . 'cache/twig/';
+
+ // Initiate the loader, __main__ namespace paths will be setup later in set_style_names()
+ $loader = new Twig_Loader_Filesystem('');
+
+ $this->twig = new phpbb_template_twig_environment(
+ $this->config,
+ ($this->extension_manager) ? $this->extension_manager->all_enabled() : array(),
+ $this->phpbb_root_path,
+ $loader,
+ array(
+ 'cache' => (defined('IN_INSTALL')) ? false : $this->cachepath,
+ 'debug' => defined('DEBUG'),
+ 'auto_reload' => (bool) $this->config['load_tplcompile'],
+ 'autoescape' => false,
+ )
+ );
+
+ $this->twig->addExtension(
+ new phpbb_template_twig_extension(
+ $this->context,
+ $this->user
+ )
+ );
+
+ $lexer = new phpbb_template_twig_lexer($this->twig);
+
+ $this->twig->setLexer($lexer);
+ }
+
+ /**
+ * Clear the cache
+ *
+ * @return phpbb_template
+ */
+ public function clear_cache()
+ {
+ if (is_dir($this->cachepath))
+ {
+ $this->twig->clearCacheFiles();
+ }
+
+ return $this;
+ }
+
+ /**
+ * Sets the template filenames for handles.
+ *
+ * @param array $filename_array Should be a hash of handle => filename pairs.
+ * @return phpbb_template $this
+ */
+ public function set_filenames(array $filename_array)
+ {
+ $this->filenames = array_merge($this->filenames, $filename_array);
+
+ return $this;
+ }
+
+ /**
+ * Sets the style names/paths corresponding to style hierarchy being compiled
+ * and/or rendered.
+ *
+ * @param array $style_names List of style names in inheritance tree order
+ * @param array $style_paths List of style paths in inheritance tree order
+ * @param bool $is_core True if the style names are the "core" styles for this page load
+ * Core means the main phpBB template files
+ * @return phpbb_template $this
+ */
+ public function set_style_names(array $style_names, array $style_paths, $is_core = false)
+ {
+ $this->style_names = $style_names;
+
+ // Set as __main__ namespace
+ $this->twig->getLoader()->setPaths($style_paths);
+
+ // Core style namespace from phpbb_style::set_style()
+ if ($is_core)
+ {
+ $this->twig->getLoader()->setPaths($style_paths, 'core');
+ }
+
+ // Add admin namespace
+ if (is_dir($this->phpbb_root_path . $this->adm_relative_path . 'style/'))
+ {
+ $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->adm_relative_path . 'style/', 'admin');
+ }
+
+ // Add all namespaces for all extensions
+ if ($this->extension_manager instanceof phpbb_extension_manager)
+ {
+ $style_names[] = 'all';
+
+ foreach ($this->extension_manager->all_enabled() as $ext_namespace => $ext_path)
+ {
+ // namespaces cannot contain /
+ $namespace = str_replace('/', '_', $ext_namespace);
+ $paths = array();
+
+ foreach ($style_names as $style_name)
+ {
+ $ext_style_path = $ext_path . 'styles/' . $style_name . '/template';
+
+ if (is_dir($ext_style_path))
+ {
+ $paths[] = $ext_style_path;
+ }
+ }
+
+ $this->twig->getLoader()->setPaths($paths, $namespace);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears all variables and blocks assigned to this template.
+ *
+ * @return phpbb_template $this
+ */
+ public function destroy()
+ {
+ $this->context = array();
+
+ return $this;
+ }
+
+ /**
+ * Reset/empty complete block
+ *
+ * @param string $blockname Name of block to destroy
+ * @return phpbb_template $this
+ */
+ public function destroy_block_vars($blockname)
+ {
+ $this->context->destroy_block_vars($blockname);
+
+ return $this;
+ }
+
+ /**
+ * Display a template for provided handle.
+ *
+ * The template will be loaded and compiled, if necessary, first.
+ *
+ * This function calls hooks.
+ *
+ * @param string $handle Handle to display
+ * @return phpbb_template $this
+ */
+ public function display($handle)
+ {
+ $result = $this->call_hook($handle, __FUNCTION__);
+ if ($result !== false)
+ {
+ return $result[0];
+ }
+
+ $this->twig->display($this->get_filename_from_handle($handle), $this->get_template_vars());
+
+ return $this;
+ }
+
+ /**
+ * Calls hook if any is defined.
+ *
+ * @param string $handle Template handle being displayed.
+ * @param string $method Method name of the caller.
+ */
+ protected function call_hook($handle, $method)
+ {
+ global $phpbb_hook;
+
+ if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this))
+ {
+ if ($phpbb_hook->hook_return(array(__CLASS__, $method)))
+ {
+ $result = $phpbb_hook->hook_return_result(array(__CLASS__, $method));
+ return array($result);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Display the handle and assign the output to a template variable
+ * or return the compiled result.
+ *
+ * @param string $handle Handle to operate on
+ * @param string $template_var Template variable to assign compiled handle to
+ * @param bool $return_content If true return compiled handle, otherwise assign to $template_var
+ * @return phpbb_template|string if $return_content is true return string of the compiled handle, otherwise return $this
+ */
+ public function assign_display($handle, $template_var = '', $return_content = true)
+ {
+ if ($return_content)
+ {
+ return $this->twig->render($this->get_filename_from_handle($handle), $this->get_template_vars());
+ }
+
+ $this->assign_var($template_var, $this->twig->render($this->get_filename_from_handle($handle, $this->get_template_vars())));
+
+ return $this;
+ }
+
+ /**
+ * Assign key variable pairs from an array
+ *
+ * @param array $vararray A hash of variable name => value pairs
+ * @return phpbb_template $this
+ */
+ public function assign_vars(array $vararray)
+ {
+ foreach ($vararray as $key => $val)
+ {
+ $this->assign_var($key, $val);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Assign a single scalar value to a single key.
+ *
+ * Value can be a string, an integer or a boolean.
+ *
+ * @param string $varname Variable name
+ * @param string $varval Value to assign to variable
+ * @return phpbb_template $this
+ */
+ public function assign_var($varname, $varval)
+ {
+ $this->context->assign_var($varname, $varval);
+
+ return $this;
+ }
+
+ /**
+ * Append text to the string value stored in a key.
+ *
+ * Text is appended using the string concatenation operator (.).
+ *
+ * @param string $varname Variable name
+ * @param string $varval Value to append to variable
+ * @return phpbb_template $this
+ */
+ public function append_var($varname, $varval)
+ {
+ $this->context->append_var($varname, $varval);
+
+ return $this;
+ }
+
+ /**
+ * Assign key variable pairs from an array to a specified block
+ * @param string $blockname Name of block to assign $vararray to
+ * @param array $vararray A hash of variable name => value pairs
+ * @return phpbb_template $this
+ */
+ public function assign_block_vars($blockname, array $vararray)
+ {
+ $this->context->assign_block_vars($blockname, $vararray);
+
+ return $this;
+ }
+
+ /**
+ * Change already assigned key variable pair (one-dimensional - single loop entry)
+ *
+ * An example of how to use this function:
+ * {@example alter_block_array.php}
+ *
+ * @param string $blockname the blockname, for example 'loop'
+ * @param array $vararray the var array to insert/add or merge
+ * @param mixed $key Key to search for
+ *
+ * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
+ *
+ * int: Position [the position to change or insert at directly given]
+ *
+ * If key is false the position is set to 0
+ * If key is true the position is set to the last entry
+ *
+ * @param string $mode Mode to execute (valid modes are 'insert' and 'change')
+ *
+ * If insert, the vararray is inserted at the given position (position counting from zero).
+ * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
+ *
+ * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
+ * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
+ *
+ * @return bool false on error, true on success
+ */
+ public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
+ {
+ return $this->context->alter_block_array($blockname, $vararray, $key, $mode);
+ }
+
+ /**
+ * Get template vars in a format Twig will use (from the context)
+ *
+ * @return array
+ */
+ public function get_template_vars()
+ {
+ $context_vars = $this->context->get_data_ref();
+
+ $vars = array_merge(
+ $context_vars['.'][0], // To get normal vars
+ $context_vars, // To get loops
+ array(
+ 'definition' => new phpbb_template_twig_definition(),
+ 'user' => $this->user,
+ )
+ );
+
+ // cleanup
+ unset($vars['.']);
+
+ return $vars;
+ }
+
+ /**
+ * Get a filename from the handle
+ *
+ * @param string $handle
+ * @return string
+ */
+ protected function get_filename_from_handle($handle)
+ {
+ return (isset($this->filenames[$handle])) ? $this->filenames[$handle] : $handle;
+ }
+
+ /**
+ * Get path to template for handle (required for BBCode parser)
+ *
+ * @return string
+ */
+ public function get_source_file_for_handle($handle)
+ {
+ return $this->twig->getLoader()->getCacheKey($this->get_filename_from_handle($handle));
+ }
+}
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 b39438e315..b39438e315 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 ce9fae13ef..3f2e7a91ff 100644
--- a/phpBB/report.php
+++ b/phpBB/report.php
@@ -144,9 +144,25 @@ else
$reported_post_enable_magic_url = $report_data['reported_post_enable_magic_url'];
}
+if ($config['enable_post_confirm'] && !$user->data['is_registered'])
+{
+ include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
+ $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $captcha->init(CONFIRM_REPORT);
+}
+
+$error = array();
+$s_hidden_fields = '';
+
// Submit report?
if ($submit && $reason_id)
{
+ $visual_confirmation_response = $captcha->validate();
+ if ($visual_confirmation_response)
+ {
+ $error[] = $visual_confirmation_response;
+ }
+
$sql = 'SELECT *
FROM ' . REPORTS_REASONS_TABLE . "
WHERE reason_id = $reason_id";
@@ -156,96 +172,108 @@ if ($submit && $reason_id)
if (!$row || (!$report_text && strtolower($row['reason_title']) == 'other'))
{
- trigger_error('EMPTY_REPORT');
+ $error[] = $user->lang('EMPTY_REPORT');
}
- $sql_ary = array(
- 'reason_id' => (int) $reason_id,
- 'post_id' => $post_id,
- 'pm_id' => $pm_id,
- 'user_id' => (int) $user->data['user_id'],
- 'user_notify' => (int) $user_notify,
- 'report_closed' => 0,
- 'report_time' => (int) time(),
- 'report_text' => (string) $report_text,
- 'reported_post_text' => $reported_post_text,
- 'reported_post_uid' => $reported_post_uid,
- 'reported_post_bitfield' => $reported_post_bitfield,
- 'reported_post_enable_bbcode' => $reported_post_enable_bbcode,
- 'reported_post_enable_smilies' => $reported_post_enable_smilies,
- 'reported_post_enable_magic_url' => $reported_post_enable_magic_url,
- );
-
- $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
- $db->sql_query($sql);
- $report_id = $db->sql_nextid();
-
- $phpbb_notifications = $phpbb_container->get('notification_manager');
-
- if ($post_id)
+ if (!sizeof($error))
{
- $sql = 'UPDATE ' . POSTS_TABLE . '
- SET post_reported = 1
- WHERE post_id = ' . $post_id;
- $db->sql_query($sql);
-
- if (!$report_data['topic_reported'])
+ if (isset($captcha))
{
- $sql = 'UPDATE ' . TOPICS_TABLE . '
- SET topic_reported = 1
- WHERE topic_id = ' . $report_data['topic_id'] . '
- OR topic_moved_id = ' . $report_data['topic_id'];
- $db->sql_query($sql);
+ $captcha->reset();
}
- $lang_return = $user->lang['RETURN_TOPIC'];
- $lang_success = $user->lang['POST_REPORTED_SUCCESS'];
-
- $phpbb_notifications->add_notifications('report_post', array_merge($report_data, $row, $forum_data, array(
- 'report_text' => $report_text,
- )));
- }
- else
- {
- $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
- SET message_reported = 1
- WHERE msg_id = ' . $pm_id;
- $db->sql_query($sql);
-
$sql_ary = array(
- 'msg_id' => $pm_id,
- 'user_id' => ANONYMOUS,
- 'author_id' => (int) $report_data['author_id'],
- 'pm_deleted' => 0,
- 'pm_new' => 0,
- 'pm_unread' => 0,
- 'pm_replied' => 0,
- 'pm_marked' => 0,
- 'pm_forwarded' => 0,
- 'folder_id' => PRIVMSGS_INBOX,
+ 'reason_id' => (int) $reason_id,
+ 'post_id' => $post_id,
+ 'pm_id' => $pm_id,
+ 'user_id' => (int) $user->data['user_id'],
+ 'user_notify' => (int) $user_notify,
+ 'report_closed' => 0,
+ 'report_time' => (int) time(),
+ 'report_text' => (string) $report_text,
+ 'reported_post_text' => $reported_post_text,
+ 'reported_post_uid' => $reported_post_uid,
+ 'reported_post_bitfield' => $reported_post_bitfield,
+ 'reported_post_enable_bbcode' => $reported_post_enable_bbcode,
+ 'reported_post_enable_smilies' => $reported_post_enable_smilies,
+ 'reported_post_enable_magic_url' => $reported_post_enable_magic_url,
);
- $sql = 'INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
+ $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
+ $report_id = $db->sql_nextid();
- $lang_return = $user->lang['RETURN_PM'];
- $lang_success = $user->lang['PM_REPORTED_SUCCESS'];
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->add_notifications('report_pm', array_merge($report_data, $row, array(
- 'report_text' => $report_text,
- 'from_user_id' => $report_data['author_id'],
- 'report_id' => $report_id,
- )));
- }
+ if ($post_id)
+ {
+ $sql = 'UPDATE ' . POSTS_TABLE . '
+ SET post_reported = 1
+ WHERE post_id = ' . $post_id;
+ $db->sql_query($sql);
- meta_refresh(3, $redirect_url);
+ if (!$report_data['topic_reported'])
+ {
+ $sql = 'UPDATE ' . TOPICS_TABLE . '
+ SET topic_reported = 1
+ WHERE topic_id = ' . $report_data['topic_id'] . '
+ OR topic_moved_id = ' . $report_data['topic_id'];
+ $db->sql_query($sql);
+ }
+
+ $lang_return = $user->lang['RETURN_TOPIC'];
+ $lang_success = $user->lang['POST_REPORTED_SUCCESS'];
+
+ $phpbb_notifications->add_notifications('report_post', array_merge($report_data, $row, $forum_data, array(
+ 'report_text' => $report_text,
+ )));
+ }
+ else
+ {
+ $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
+ SET message_reported = 1
+ WHERE msg_id = ' . $pm_id;
+ $db->sql_query($sql);
+
+ $sql_ary = array(
+ 'msg_id' => $pm_id,
+ 'user_id' => ANONYMOUS,
+ 'author_id' => (int) $report_data['author_id'],
+ 'pm_deleted' => 0,
+ 'pm_new' => 0,
+ 'pm_unread' => 0,
+ 'pm_replied' => 0,
+ 'pm_marked' => 0,
+ 'pm_forwarded' => 0,
+ 'folder_id' => PRIVMSGS_INBOX,
+ );
+
+ $sql = 'INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
+ $db->sql_query($sql);
+
+ $lang_return = $user->lang['RETURN_PM'];
+ $lang_success = $user->lang['PM_REPORTED_SUCCESS'];
+
+ $phpbb_notifications->add_notifications('report_pm', array_merge($report_data, $row, array(
+ 'report_text' => $report_text,
+ 'from_user_id' => $report_data['author_id'],
+ 'report_id' => $report_id,
+ )));
+ }
+
+ meta_refresh(3, $redirect_url);
- $message = $lang_success . '<br /><br />' . sprintf($lang_return, '<a href="' . $redirect_url . '">', '</a>');
- if ($return_forum_url)
+ $message = $lang_success . '<br /><br />' . sprintf($lang_return, '<a href="' . $redirect_url . '">', '</a>');
+ if ($return_forum_url)
+ {
+ $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>');
+ }
+ trigger_error($message);
+ }
+ else if (isset($captcha) && $captcha->is_solved() !== false)
{
- $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>');
+ $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields());
}
- trigger_error($message);
}
// Generate the reasons
@@ -253,10 +281,20 @@ display_reasons($reason_id);
$page_title = ($pm_id) ? $user->lang['REPORT_MESSAGE'] : $user->lang['REPORT_POST'];
+if (isset($captcha) && $captcha->is_solved() === false)
+{
+ $template->assign_vars(array(
+ 'S_CONFIRM_CODE' => true,
+ 'CAPTCHA_TEMPLATE' => $captcha->get_template(),
+ ));
+}
+
$template->assign_vars(array(
+ 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'S_REPORT_POST' => ($pm_id) ? false : true,
'REPORT_TEXT' => $report_text,
'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&amp;p=' . $post_id . '&amp;pm=' . $pm_id),
+ 'S_HIDDEN_FIELDS' => (sizeof($s_hidden_fields)) ? $s_hidden_fields : null,
'S_NOTIFY' => $user_notify,
'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false)
diff --git a/phpBB/search.php b/phpBB/search.php
index 7d20d8d4a2..2429c81dae 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';
@@ -380,7 +369,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
WHERE t.topic_replies = 0
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';
@@ -393,7 +382,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
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/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 ac686932b7..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 />
@@ -85,8 +86,8 @@
<!-- ENDIF -->
<fieldset class="display-options">
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
<label>{L_DISPLAY_TOPICS}{L_COLON} {S_SELECT_SORT_DAYS}</label>
<label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label>
<label>{S_SELECT_SORT_DIR} <input type="submit" name="sort" value="{L_GO}" class="button2" /></label>
@@ -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_logs.html b/phpBB/styles/prosilver/template/mcp_logs.html
index c9db4e8afa..492c8cf201 100644
--- a/phpBB/styles/prosilver/template/mcp_logs.html
+++ b/phpBB/styles/prosilver/template/mcp_logs.html
@@ -54,8 +54,8 @@
<!-- IF .log -->
<fieldset class="display-options">
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
<label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label>
<label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label>
<label>{S_SELECT_SORT_DIR}</label>
diff --git a/phpBB/styles/prosilver/template/mcp_notes_user.html b/phpBB/styles/prosilver/template/mcp_notes_user.html
index 328d12a04f..1738e45045 100644
--- a/phpBB/styles/prosilver/template/mcp_notes_user.html
+++ b/phpBB/styles/prosilver/template/mcp_notes_user.html
@@ -95,8 +95,8 @@
<hr />
<fieldset class="display-options">
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
<label>{L_DISPLAY_LOG}{L_COLON} {S_SELECT_SORT_DAYS}</label>
<label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label>
<input type="submit" name="sort" value="{L_GO}" class="button2" />
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 4d20804e66..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 -->
@@ -67,8 +73,8 @@
</ul>
<fieldset class="display-options">
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
<label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label>
<label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label>
<!-- IF TOPIC_ID --><label><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" />&nbsp; <strong>{L_ONLY_TOPIC}</strong></label><!-- 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_reports.html b/phpBB/styles/prosilver/template/mcp_reports.html
index 9a70b4a62a..902744fe25 100644
--- a/phpBB/styles/prosilver/template/mcp_reports.html
+++ b/phpBB/styles/prosilver/template/mcp_reports.html
@@ -72,8 +72,8 @@
</ul>
<fieldset class="display-options">
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
<label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label>
<label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label>
<!-- IF TOPIC_ID --><label><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" />&nbsp; <strong>{L_ONLY_TOPIC}</strong></label><!-- ENDIF -->
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/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html
index 17dc2c33c0..07a7e2e182 100644
--- a/phpBB/styles/prosilver/template/memberlist_body.html
+++ b/phpBB/styles/prosilver/template/memberlist_body.html
@@ -140,8 +140,8 @@
<!-- IF S_IN_SEARCH_POPUP and not S_SEARCH_USER -->
<fieldset class="display-options">
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
<label for="sk">{L_SELECT_SORT_METHOD}{L_COLON} <select name="sk" id="sk">{S_MODE_SELECT}</select></label>
<label for="sd">{L_ORDER} <select name="sd" id="sd">{S_ORDER_SELECT}</select> <input type="submit" name="sort" value="{L_SUBMIT}" class="button2" /></label>
</fieldset>
diff --git a/phpBB/styles/prosilver/template/memberlist_search.html b/phpBB/styles/prosilver/template/memberlist_search.html
index 61bfd630ff..4f029627fc 100644
--- a/phpBB/styles/prosilver/template/memberlist_search.html
+++ b/phpBB/styles/prosilver/template/memberlist_search.html
@@ -38,7 +38,7 @@ function insert_single(user)
// ]]>
</script>
<!-- ENDIF -->
-<!-- INCLUDEJS template/forum_fn.js -->
+<!-- INCLUDEJS forum_fn.js -->
<h2 class="solo">{L_FIND_USERNAME}</h2>
<form method="post" action="{S_MODE_ACTION}" id="search_memberlist">
@@ -74,6 +74,10 @@ function insert_single(user)
<dt><label for="msn">{L_MSNM}{L_COLON}</label></dt>
<dd><input type="text" name="msn" id="msn" value="{MSNM}" class="inputbox" /></dd>
</dl>
+ <dl>
+ <dt><label for="jabber">{L_JABBER}:</label></dt>
+ <dd><input type="text" name="jabber" id="jabber" value="{JABBER}" class="inputbox" /></dd>
+ </dl>
</fieldset>
<fieldset class="fields1 column2">
diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html
index ba0412ddd3..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>
@@ -53,11 +58,13 @@
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- 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_SUPER_TEMPLATE_PATH}/forum_fn.js?assets_version={T_ASSETS_VERSION}"></script>
-<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script>
-<!-- INCLUDEJS template/ajax.js -->
-{SCRIPTS}
+<!-- INCLUDEJS forum_fn.js -->
+<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/core.js -->
+<!-- INCLUDEJS ajax.js -->
<!-- EVENT overall_footer_after -->
+
+{$SCRIPTS}
+
</body>
</html>
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 3c98edec79..ddbd917bd6 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -76,6 +76,8 @@
<!-- EVENT overall_header_head_append -->
+{$STYLESHEETS}
+
</head>
<body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}">
@@ -125,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>
@@ -168,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 fadbc9b3ca..798faa2ff7 100644
--- a/phpBB/styles/prosilver/template/posting_buttons.html
+++ b/phpBB/styles/prosilver/template/posting_buttons.html
@@ -32,14 +32,11 @@
<!-- END custom_tags -->
}
- var panels = new Array('options-panel', 'attach-panel', 'poll-panel');
- var show_panel = 'options-panel';
-
function change_palette()
{
dE('colour_palette');
e = document.getElementById('colour_palette');
-
+
if (e.style.display == 'block')
{
document.getElementById('bbpalette').value = '{LA_FONT_COLOR_HIDE}';
@@ -52,7 +49,7 @@
// ]]>
</script>
-<!-- INCLUDEJS template/editor.js -->
+<!-- INCLUDEJS editor.js -->
<!-- IF S_BBCODE_ALLOWED -->
<div id="colour_palette" style="display: none;">
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/report_body.html b/phpBB/styles/prosilver/template/report_body.html
index 4cb03dc51c..2a5e6c9d0e 100644
--- a/phpBB/styles/prosilver/template/report_body.html
+++ b/phpBB/styles/prosilver/template/report_body.html
@@ -10,6 +10,7 @@
<p><!-- IF S_REPORT_POST -->{L_REPORT_POST_EXPLAIN}<!-- ELSE -->{L_REPORT_MESSAGE_EXPLAIN}<!-- ENDIF --></p>
<fieldset>
+ <!-- IF ERROR --><dl><dd class="error">{ERROR}</dd></dl><!-- ENDIF -->
<dl class="fields2">
<dt><label for="reason_id">{L_REASON}{L_COLON}</label></dt>
<dd><select name="reason_id" id="reason_id" class="full"><!-- BEGIN reason --><option value="{reason.ID}"<!-- IF reason.S_SELECTED --> selected="selected"<!-- ENDIF -->>{reason.DESCRIPTION}</option><!-- END reason --></select></dd>
@@ -27,6 +28,9 @@
<dt><label for="report_text">{L_MORE_INFO}{L_COLON}</label><br /><span>{L_CAN_LEAVE_BLANK}</span></dt>
<dd><textarea name="report_text" id="report_text" rows="10" cols="76" class="inputbox">{REPORT_TEXT}</textarea></dd>
</dl>
+ <!-- IF CAPTCHA_TEMPLATE -->
+ <!-- INCLUDE {CAPTCHA_TEMPLATE} -->
+ <!-- ENDIF -->
</fieldset>
</div>
diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html
index 1132e5295a..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">
@@ -154,8 +155,8 @@
<form method="post" action="{S_SEARCH_ACTION}">
<fieldset class="display-options">
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
<!-- IF S_SELECT_SORT_DAYS or S_SELECT_SORT_KEY -->
<label><!-- IF S_SHOW_TOPICS -->{L_DISPLAY_POSTS}<!-- ELSE -->{L_SORT_BY}</label><label><!-- ENDIF --> {S_SELECT_SORT_DAYS}<!-- IF S_SELECT_SORT_KEY --></label> <label>{S_SELECT_SORT_KEY}</label>
<label>{S_SELECT_SORT_DIR}<!-- ENDIF --> <input type="submit" name="sort" value="{L_GO}" class="button2" /></label>
diff --git a/phpBB/styles/prosilver/template/timezone_option.html b/phpBB/styles/prosilver/template/timezone_option.html
index a77e82f9a1..fc0579bffd 100644
--- a/phpBB/styles/prosilver/template/timezone_option.html
+++ b/phpBB/styles/prosilver/template/timezone_option.html
@@ -15,6 +15,6 @@
{S_TZ_OPTIONS}
</select>
- <!-- INCLUDEJS template/timezone.js -->
+ <!-- INCLUDEJS timezone.js -->
</dd>
</dl>
diff --git a/phpBB/styles/prosilver/template/ucp_attachments.html b/phpBB/styles/prosilver/template/ucp_attachments.html
index 6e1bdfdd57..feb04278dc 100644
--- a/phpBB/styles/prosilver/template/ucp_attachments.html
+++ b/phpBB/styles/prosilver/template/ucp_attachments.html
@@ -51,8 +51,8 @@
</ul>
<fieldset class="display-options">
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
<label for="sk">{L_SORT_BY}{L_COLON} <select name="sk" id="sk">{S_SORT_OPTIONS}</select></label>
<label><select name="sd" id="sd">{S_ORDER_SELECT}</select></label>
<input class="button2" type="submit" name="sort" value="{L_SORT}" />
diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options.html b/phpBB/styles/prosilver/template/ucp_avatar_options.html
index e7f4a48e11..072f235eb1 100644
--- a/phpBB/styles/prosilver/template/ucp_avatar_options.html
+++ b/phpBB/styles/prosilver/template/ucp_avatar_options.html
@@ -47,4 +47,4 @@
</div>
</div>
-<!-- INCLUDEJS template/avatars.js -->
+<!-- INCLUDEJS avatars.js -->
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html
index 00b735fae6..c5078df268 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html
@@ -122,8 +122,8 @@
<!-- IF FOLDER_CUR_MESSAGES neq 0 -->
<fieldset class="display-options">
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
<label>{L_DISPLAY}{L_COLON} {S_SELECT_SORT_DAYS}</label>
<label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label>
<label>{S_SELECT_SORT_DIR} <input type="submit" name="sort" value="{L_GO}" class="button2" /></label>
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index dd16b27988..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">
@@ -192,8 +193,8 @@
<!-- IF S_SELECT_SORT_DAYS and not S_DISPLAY_ACTIVE -->
<form method="post" action="{S_FORUM_ACTION}">
<fieldset class="display-options">
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
<!-- IF not S_IS_BOT -->
<label>{L_DISPLAY_TOPICS}{L_COLON} {S_SELECT_SORT_DAYS}</label>
<label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label>
diff --git a/phpBB/styles/prosilver/template/viewonline_body.html b/phpBB/styles/prosilver/template/viewonline_body.html
index cb19a40d8f..74e891f7d0 100644
--- a/phpBB/styles/prosilver/template/viewonline_body.html
+++ b/phpBB/styles/prosilver/template/viewonline_body.html
@@ -47,9 +47,9 @@
</div>
</div>
-<!-- IF PREVIOUS_PAGE or NEXT_PAGE -->
+<!-- IF U_PREVIOUS_PAGE or U_NEXT_PAGE -->
<fieldset class="display-options right-box">
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ELSE -->{L_PREVIOUS}<!-- ENDIF --> &bull; <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ELSE -->{L_NEXT}<!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ELSE -->{L_PREVIOUS}<!-- ENDIF --> &bull; <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ELSE -->{L_NEXT}<!-- ENDIF -->
</fieldset>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 5f999ade0c..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>
@@ -245,12 +270,12 @@
<!-- IF S_QUICK_REPLY -->
<!-- INCLUDE quickreply_editor.html -->
<!-- ENDIF -->
-<!-- IF S_NUM_POSTS > 1 or PREVIOUS_PAGE or NEXT_PAGE -->
+<!-- IF S_NUM_POSTS > 1 or U_PREVIOUS_PAGE or U_NEXT_PAGE -->
<form id="viewtopic" method="post" action="{S_TOPIC_ACTION}">
<fieldset class="display-options" style="margin-top: 0; ">
- <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
- <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
+ <!-- IF U_PREVIOUS_PAGE --><a href="{U_PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF -->
+ <!-- IF U_NEXT_PAGE --><a href="{U_NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF -->
<!-- IF not S_IS_BOT -->
<label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label>
<label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> <label>{S_SELECT_SORT_DIR} <input type="submit" name="sort" value="{L_GO}" class="button2" /></label>
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..e58386de45 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 {
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css
index b6db4c7230..4b8c972697 100644
--- a/phpBB/styles/prosilver/theme/content.css
+++ b/phpBB/styles/prosilver/theme/content.css
@@ -159,7 +159,7 @@ dl.icon dt .list-inner {
}
dl.icon dt, dl.icon dd {
- min-height: 40px;
+ min-height: 35px;
}
dd.posts, dd.topics, dd.views, dd.extra, dd.mark {
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/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html
index 3a29a0d752..d2b30c22a0 100644
--- a/phpBB/styles/subsilver2/template/overall_footer.html
+++ b/phpBB/styles/subsilver2/template/overall_footer.html
@@ -13,9 +13,11 @@
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- 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>
-{SCRIPTS}
+<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/core.js -->
<!-- EVENT overall_footer_after -->
+
+{$SCRIPTS}
+
</body>
</html>
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index 0317d6e45c..bc2307154b 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -132,6 +132,8 @@ function marklist(id, name, state)
<!-- EVENT overall_header_head_append -->
+{$STYLESHEETS}
+
</head>
<body class="{S_CONTENT_DIRECTION}">
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/report_body.html b/phpBB/styles/subsilver2/template/report_body.html
index 9ed510bb9f..906a957ef4 100644
--- a/phpBB/styles/subsilver2/template/report_body.html
+++ b/phpBB/styles/subsilver2/template/report_body.html
@@ -6,6 +6,11 @@
<tr>
<th colspan="2"><!-- IF S_REPORT_POST -->{L_REPORT_POST}<!-- ELSE -->{L_REPORT_MESSAGE}<!-- ENDIF --></th>
</tr>
+<!-- IF ERROR -->
+ <tr>
+ <td class="row3" colspan="2" align="center"><span class="genmed error">{ERROR}</span></td>
+ </tr>
+<!-- ENDIF -->
<tr>
<td class="row3" colspan="2"><span class="gensmall"><!-- IF S_REPORT_POST -->{L_REPORT_POST_EXPLAIN}<!-- ELSE -->{L_REPORT_MESSAGE_EXPLAIN}<!-- ENDIF --></span></td>
</tr>
@@ -25,6 +30,9 @@
<td class="row1" valign="top"><span class="gen"><b>{L_MORE_INFO}{L_COLON}</b></span><br /><span class="gensmall">{L_CAN_LEAVE_BLANK}</span></td>
<td class="row2"><textarea class="post" name="report_text" rows="10" cols="50">{REPORT_TEXT}</textarea></td>
</tr>
+<!-- IF CAPTCHA_TEMPLATE -->
+ <!-- INCLUDE {CAPTCHA_TEMPLATE} -->
+<!-- ENDIF -->
<tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="submit" class="btnmain" value="{L_SUBMIT}" />&nbsp;<input type="submit" name="cancel" class="btnlite" value="{L_CANCEL}" /></td>
</tr>
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/timezone_option.html b/phpBB/styles/subsilver2/template/timezone_option.html
index 26ba2388c9..0f27719f86 100644
--- a/phpBB/styles/subsilver2/template/timezone_option.html
+++ b/phpBB/styles/subsilver2/template/timezone_option.html
@@ -15,6 +15,6 @@
{S_TZ_OPTIONS}
</select>
- <!-- INCLUDEJS template/timezone.js -->
+ <!-- INCLUDEJS timezone.js -->
</td>
</tr>
diff --git a/phpBB/styles/subsilver2/template/ucp_groups_manage.html b/phpBB/styles/subsilver2/template/ucp_groups_manage.html
index 8064e1e6e9..b8e7e29481 100644
--- a/phpBB/styles/subsilver2/template/ucp_groups_manage.html
+++ b/phpBB/styles/subsilver2/template/ucp_groups_manage.html
@@ -95,7 +95,7 @@
</tr>
</table>
-<!-- INCLUDEJS template/avatars.js -->
+<!-- INCLUDEJS avatars.js -->
<!-- ELSEIF S_LIST -->
diff --git a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html
index 697cceabb9..60a816d00a 100644
--- a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html
+++ b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html
@@ -48,6 +48,6 @@
</tr>
</table>
-<!-- INCLUDEJS template/avatars.js -->
+<!-- INCLUDEJS avatars.js -->
<!-- INCLUDE ucp_footer.html -->
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 59ef7bbc80..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);
@@ -145,7 +146,14 @@ if ($view && !$post_id)
if (!$row)
{
- $user->setup('viewtopic');
+ $sql = 'SELECT forum_style
+ FROM ' . FORUMS_TABLE . "
+ WHERE forum_id = $forum_id";
+ $result = $db->sql_query($sql);
+ $forum_style = (int) $db->sql_fetchfield('forum_style');
+ $db->sql_freeresult($result);
+
+ $user->setup('viewtopic', $forum_style);
trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS');
}
else
@@ -174,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';
}
@@ -245,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)
@@ -265,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
{
@@ -277,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')
{
@@ -297,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())
@@ -315,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))
{
@@ -402,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);
@@ -524,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)),
@@ -609,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'),
@@ -929,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;
@@ -938,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";
@@ -1020,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'],
@@ -1042,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'],
@@ -1313,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);
@@ -1495,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']]) )
{
@@ -1531,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!
@@ -1563,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'),
@@ -1589,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,
@@ -1605,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,
@@ -1614,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/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md
index f89c1fefeb..f2688ab675 100644
--- a/tests/RUNNING_TESTS.md
+++ b/tests/RUNNING_TESTS.md
@@ -50,9 +50,11 @@ Database Tests
By default all tests requiring a database connection will use sqlite. If you
do not have sqlite installed the tests will be skipped. If you wish to run the
tests on a different database you have to create a test_config.php file within
-your tests directory following the same format as phpBB's config.php. An
-example for mysqli can be found below. More information on configuration
-options can be found on the wiki (see below).
+your tests directory following the same format as phpBB's config.php. Testing
+makes use of a seperate database defined in this config file and before running
+the tests each time this database is deleted. An example for mysqli can be
+found below. More information on configuration options can be found on the
+wiki (see below).
<?php
$dbms = 'phpbb_db_driver_mysqli';
@@ -132,8 +134,36 @@ only want the slow tests, run:
$ phpBB/vendor/bin/phpunit --group slow
+Functional tests
+-----------------
+
+Functional tests test software the way a user would. They simulate a user
+browsing the website, but they do these steps in an automated way.
+phpBB allows you to write such tests.
+
+Running
+=======
+
+Running the tests requires your phpBB3 repository to be accessible through a
+local web server. You will need to supply the URL to the webserver in
+the 'tests/test_config.php' file. This is as simple as defining the
+'$phpbb_functional_url' variable, which contains the URL for the directory containing
+the board. Make sure you include the trailing slash. Note that without extensive
+changes to the test framework, you cannot use a board outside of the repository
+on which to run tests.
+
+ $phpbb_functional_url = 'http://localhost/phpBB3/';
+
+To then run the tests, you run PHPUnit, but use the phpunit.xml.functional
+config file instead of the default one. Specify this through the "-c" option:
+
+ $ phpBB/vendor/bin/phpunit -c phpunit.xml.functional
+
+This will change your board's config.php file, but it makes a backup at
+config_dev.php, so you can restore it after the test run is complete.
+
More Information
================
Further information is available on phpbb wiki:
-http://wiki.phpbb.com/Unit_Tests
+http://wiki.phpbb.com/Automated_Tests
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/auth/fixtures/user.xml b/tests/auth/fixtures/user.xml
new file mode 100644
index 0000000000..34584babbf
--- /dev/null
+++ b/tests/auth/fixtures/user.xml
@@ -0,0 +1,33 @@
+<?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_password</column>
+ <column>user_passchg</column>
+ <column>user_pass_convert</column>
+ <column>user_email</column>
+ <column>user_type</column>
+ <column>user_login_attempts</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>1</value>
+ <value>foobar</value>
+ <value>foobar</value>
+ <value>$H$9E45lK6J8nLTSm9oJE5aNCSTFK9wqa/</value>
+ <value>0</value>
+ <value>0</value>
+ <value>example@example.com</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php
new file mode 100644
index 0000000000..0ca6ef763e
--- /dev/null
+++ b/tests/auth/provider_apache_test.php
@@ -0,0 +1,206 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__).'/../../phpBB/includes/functions.php';
+
+class phpbb_auth_provider_apache_test extends phpbb_database_test_case
+{
+ protected $provider;
+ protected $user;
+ protected $request;
+
+ protected function setup()
+ {
+ parent::setUp();
+
+ global $phpbb_root_path, $phpEx;
+
+ $db = $this->new_dbal();
+ $config = new phpbb_config(array());
+ $this->request = $this->getMock('phpbb_request');
+ $this->user = $this->getMock('phpbb_user');
+
+ $this->provider = new phpbb_auth_provider_apache($db, $config, $this->request, $this->user, $phpbb_root_path, $phpEx);
+ }
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/user.xml');
+ }
+
+ /**
+ * Test to see if a user is identified to Apache. Expects false if they are.
+ */
+ public function test_init()
+ {
+ $this->user->data['username'] = 'foobar';
+ $this->request->expects($this->once())
+ ->method('is_set')
+ ->with('PHP_AUTH_USER',
+ phpbb_request_interface::SERVER)
+ ->will($this->returnValue(true));
+ $this->request->expects($this->once())
+ ->method('server')
+ ->with('PHP_AUTH_USER')
+ ->will($this->returnValue('foobar'));
+
+ $this->assertFalse($this->provider->init());
+ }
+
+ public function test_login()
+ {
+ $username = 'foobar';
+ $password = 'example';
+
+ $this->request->expects($this->once())
+ ->method('is_set')
+ ->with('PHP_AUTH_USER',
+ phpbb_request_interface::SERVER)
+ ->will($this->returnValue(true));
+ $this->request->expects($this->at(1))
+ ->method('server')
+ ->with('PHP_AUTH_USER')
+ ->will($this->returnValue('foobar'));
+ $this->request->expects($this->at(2))
+ ->method('server')
+ ->with('PHP_AUTH_PW')
+ ->will($this->returnValue('example'));
+
+ $expected = array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => array(
+ 'user_id' => '1',
+ 'username' => 'foobar',
+ 'user_password' => '$H$9E45lK6J8nLTSm9oJE5aNCSTFK9wqa/',
+ 'user_passchg' => '0',
+ 'user_email' => 'example@example.com',
+ 'user_type' => '0',
+ ),
+ );
+
+ $this->assertEquals($expected, $this->provider->login($username, $password));
+ }
+
+ public function test_autologin()
+ {
+ $this->request->expects($this->once())
+ ->method('is_set')
+ ->with('PHP_AUTH_USER',
+ phpbb_request_interface::SERVER)
+ ->will($this->returnValue(true));
+ $this->request->expects($this->at(1))
+ ->method('server')
+ ->with('PHP_AUTH_USER')
+ ->will($this->returnValue('foobar'));
+ $this->request->expects($this->at(2))
+ ->method('server')
+ ->with('PHP_AUTH_PW')
+ ->will($this->returnValue('example'));
+
+ $expected = array(
+ 'user_id' => '1',
+ 'user_type' => '0',
+ 'group_id' => '3',
+ 'user_permissions' => '',
+ 'user_perm_from' => '0',
+ 'user_ip' => '',
+ 'user_regdate' => '0',
+ 'username' => 'foobar',
+ 'username_clean' => 'foobar',
+ 'user_password' => '$H$9E45lK6J8nLTSm9oJE5aNCSTFK9wqa/',
+ 'user_passchg' => '0',
+ 'user_pass_convert' => '0',
+ 'user_email' => 'example@example.com',
+ 'user_email_hash' => '0',
+ 'user_birthday' => '',
+ 'user_lastvisit' => '0',
+ 'user_lastmark' => '0',
+ 'user_lastpost_time' => '0',
+ 'user_lastpage' => '',
+ 'user_last_confirm_key' => '',
+ 'user_last_search' => '0',
+ 'user_warnings' => '0',
+ 'user_last_warning' => '0',
+ 'user_login_attempts' => '0',
+ 'user_inactive_reason' => '0',
+ 'user_inactive_time' => '0',
+ 'user_posts' => '0',
+ 'user_lang' => '',
+ 'user_timezone' => 'UTC',
+ 'user_dateformat' => 'd M Y H:i',
+ 'user_style' => '0',
+ 'user_rank' => '0',
+ 'user_colour' => '',
+ 'user_new_privmsg' => '0',
+ 'user_unread_privmsg' => '0',
+ 'user_last_privmsg' => '0',
+ 'user_message_rules' => '0',
+ 'user_full_folder' => '-3',
+ 'user_emailtime' => '0',
+ 'user_topic_show_days' => '0',
+ 'user_topic_sortby_type' => 't',
+ 'user_topic_sortby_dir' => 'd',
+ 'user_post_show_days' => '0',
+ 'user_post_sortby_type' => 't',
+ 'user_post_sortby_dir' => 'a',
+ 'user_notify' => '0',
+ 'user_notify_pm' => '1',
+ 'user_notify_type' => '0',
+ 'user_allow_pm' => '1',
+ 'user_allow_viewonline' => '1',
+ 'user_allow_viewemail' => '1',
+ 'user_allow_massemail' => '1',
+ 'user_options' => '230271',
+ 'user_avatar' => '',
+ 'user_avatar_type' => '',
+ 'user_avatar_width' => '0',
+ 'user_avatar_height' => '0',
+ 'user_sig' => '',
+ 'user_sig_bbcode_uid' => '',
+ 'user_sig_bbcode_bitfield' => '',
+ 'user_from' => '',
+ 'user_icq' => '',
+ 'user_aim' => '',
+ 'user_yim' => '',
+ 'user_msnm' => '',
+ 'user_jabber' => '',
+ 'user_website' => '',
+ 'user_occ' => '',
+ 'user_interests' => '',
+ 'user_actkey' => '',
+ 'user_newpasswd' => '',
+ 'user_form_salt' => '',
+ 'user_new' => '1',
+ 'user_reminded' => '0',
+ 'user_reminded_time' => '0',
+ );
+
+ $this->assertEquals($expected, $this->provider->autologin());
+ }
+
+ public function test_validate_session()
+ {
+ $user = array(
+ 'username' => 'foobar',
+ 'user_type'
+ );
+ $this->request->expects($this->once())
+ ->method('is_set')
+ ->with('PHP_AUTH_USER',
+ phpbb_request_interface::SERVER)
+ ->will($this->returnValue(true));
+ $this->request->expects($this->once())
+ ->method('server')
+ ->with('PHP_AUTH_USER')
+ ->will($this->returnValue('foobar'));
+
+ $this->assertTrue($this->provider->validate_session($user));
+ }
+}
diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php
new file mode 100644
index 0000000000..d876683f84
--- /dev/null
+++ b/tests/auth/provider_db_test.php
@@ -0,0 +1,50 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__).'/../../phpBB/includes/functions.php';
+
+class phpbb_auth_provider_db_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/user.xml');
+ }
+
+ public function test_login()
+ {
+ global $phpbb_root_path, $phpEx;
+
+ $db = $this->new_dbal();
+ $config = new phpbb_config(array(
+ 'ip_login_limit_max' => 0,
+ 'ip_login_limit_use_forwarded' => 0,
+ 'max_login_attempts' => 0,
+ ));
+ $request = $this->getMock('phpbb_request');
+ $user = $this->getMock('phpbb_user');
+ $provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx);
+
+ $expected = array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => array(
+ 'user_id' => '1',
+ 'username' => 'foobar',
+ 'user_password' => '$H$9E45lK6J8nLTSm9oJE5aNCSTFK9wqa/',
+ 'user_passchg' => '0',
+ 'user_pass_convert' => '0',
+ 'user_email' => 'example@example.com',
+ 'user_type' => '0',
+ 'user_login_attempts' => '0',
+ ),
+ );
+
+ $this->assertEquals($expected, $provider->login('foobar', 'example'));
+ }
+}
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/helper_url_test.php b/tests/controller/helper_url_test.php
index 2c22700ca6..6686b77e8f 100644
--- a/tests/controller/helper_url_test.php
+++ b/tests/controller/helper_url_test.php
@@ -45,15 +45,17 @@ class phpbb_controller_helper_url_test extends phpbb_test_case
*/
public function test_helper_url($route, $params, $is_amp, $session_id, $expected, $description)
{
- global $phpbb_dispatcher;
+ global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
$this->style_resource_locator = new phpbb_style_resource_locator();
$this->user = $this->getMock('phpbb_user');
- $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, new phpbb_template_context());
+ $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context());
+ $this->style_resource_locator = new phpbb_style_resource_locator();
+ $this->style_provider = new phpbb_style_path_provider();
+ $this->style = new phpbb_style($phpbb_root_path, $phpEx, new phpbb_config(array()), $this->user, $this->style_resource_locator, $this->style_provider, $this->template);
$helper = new phpbb_controller_helper($this->template, $this->user, '', 'php');
$this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected);
}
}
-
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/dbal/order_lower_test.php b/tests/dbal/order_lower_test.php
index 84d454742f..d826765681 100644
--- a/tests/dbal/order_lower_test.php
+++ b/tests/dbal/order_lower_test.php
@@ -18,6 +18,11 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case
{
$db = $this->new_dbal();
+ if (strpos($db->sql_layer, 'mysql') === 0 && version_compare($db->sql_server_info(true, false), '5.6', '>='))
+ {
+ $this->markTestSkipped('MySQL 5.6 fails to order things correctly. See also: http://tracker.phpbb.com/browse/PHPBB3-11571 http://bugs.mysql.com/bug.php?id=69005');
+ }
+
// http://tracker.phpbb.com/browse/PHPBB3-10507
// Test ORDER BY LOWER(style_name)
$db->sql_return_on_error(true);
@@ -58,7 +63,7 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case
'style_parent_id' => 0,
'style_parent_tree' => '',
)
- ),
+ ),
$db->sql_fetchrowset($result)
);
}
diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php
index d6a5ec823b..c570f19ebd 100644
--- a/tests/di/create_container_test.php
+++ b/tests/di/create_container_test.php
@@ -40,11 +40,12 @@ class phpbb_di_container_test extends phpbb_test_case
public function test_phpbb_create_compiled_container()
{
$phpbb_root_path = __DIR__ . '/../../phpBB/';
+ $config_file = __DIR__ . '/fixtures/config.php';
$extensions = array(
new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
new phpbb_di_extension_core($phpbb_root_path . 'config'),
);
- $container = phpbb_create_compiled_container($extensions, array(), $phpbb_root_path, 'php');
+ $container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php');
$this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
$this->assertTrue($container->isFrozen());
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 d410333f09..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;
@@ -42,12 +40,11 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->user = new phpbb_user();
$this->table_prefix = 'phpbb_';
- $this->template = new phpbb_template(
+ $this->template = new phpbb_template_twig(
$this->phpbb_root_path,
$this->phpEx,
$this->config,
$this->user,
- new phpbb_style_resource_locator(),
new phpbb_template_context()
);
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/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/forum_style_test.php b/tests/functional/forum_style_test.php
new file mode 100644
index 0000000000..59f7341eb6
--- /dev/null
+++ b/tests/functional/forum_style_test.php
@@ -0,0 +1,45 @@
+<?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_forum_style_test extends phpbb_functional_test_case
+{
+ public function test_default_forum_style()
+ {
+ $crawler = self::request('GET', 'viewtopic.php?t=1&f=2');
+ $this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
+
+ $crawler = self::request('GET', 'viewtopic.php?t=1');
+ $this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
+
+ $crawler = self::request('GET', 'viewtopic.php?t=1&view=next');
+ $this->assertContains('styles/prosilver/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
+ }
+
+ public function test_custom_forum_style()
+ {
+ $db = $this->get_db();
+ $this->add_style(2, 'test_style');
+ $db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 2 WHERE forum_id = 2');
+
+ $crawler = self::request('GET', 'viewtopic.php?t=1&f=2');
+ $this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
+
+ $crawler = self::request('GET', 'viewtopic.php?t=1');
+ $this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
+
+ $crawler = self::request('GET', 'viewtopic.php?t=1&view=next');
+ $this->assertContains('styles/test_style/', $crawler->filter('head > link[rel=stylesheet]')->attr('href'));
+
+ $db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 0 WHERE forum_id = 2');
+ $this->delete_style(2, 'test_style');
+ }
+}
diff --git a/tests/functional/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/paging_test.php b/tests/functional/paging_test.php
new file mode 100644
index 0000000000..d5adc6ad0a
--- /dev/null
+++ b/tests/functional/paging_test.php
@@ -0,0 +1,39 @@
+<?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_paging_test extends phpbb_functional_test_case
+{
+
+ public function test_pagination()
+ {
+ $this->login();
+
+ $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.');
+ for ($post_id = 1; $post_id < 20; $post_id++)
+ {
+ $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post no' . $post_id . ' posted by the testing framework.');
+ }
+ $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
+ $this->assertContains('post no9', $crawler->text());
+ $this->assertNotContains('post no19', $crawler->text());
+
+ $next_link = $crawler->filter('#viewtopic > fieldset > a.arrow-right')->attr('href');
+ $crawler = self::request('GET', $next_link);
+ $this->assertContains('post no19', $crawler->text());
+ $this->assertNotContains('post no9', $crawler->text());
+
+ $prev_link = $crawler->filter('#viewtopic > fieldset > a.arrow-left')->attr('href');
+ $crawler = self::request('GET', $prev_link);
+ $this->assertContains('post no9', $crawler->text());
+ $this->assertNotContains('post no19', $crawler->text());
+ }
+}
diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php
index 9bcfcc2fda..7fd1e4fdcf 100644
--- a/tests/functional/posting_test.php
+++ b/tests/functional/posting_test.php
@@ -32,105 +32,4 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$crawler = self::request('GET', "posting.php?mode=quote&f=2&t={$post2['topic_id']}&p={$post2['post_id']}&sid={$this->sid}");
$this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text());
}
-
- /**
- * Creates a topic
- *
- * Be sure to login before creating
- *
- * @param int $forum_id
- * @param string $subject
- * @param string $message
- * @param array $additional_form_data Any additional form data to be sent in the request
- * @return array post_id, topic_id
- */
- public function create_topic($forum_id, $subject, $message, $additional_form_data = array())
- {
- $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}";
-
- $form_data = array_merge(array(
- 'subject' => $subject,
- 'message' => $message,
- 'post' => true,
- ), $additional_form_data);
-
- return self::submit_post($posting_url, 'POST_TOPIC', $form_data);
- }
-
- /**
- * Creates a post
- *
- * Be sure to login before creating
- *
- * @param int $forum_id
- * @param string $subject
- * @param string $message
- * @param array $additional_form_data Any additional form data to be sent in the request
- * @return array post_id, topic_id
- */
- public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array())
- {
- $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}";
-
- $form_data = array_merge(array(
- 'subject' => $subject,
- 'message' => $message,
- 'post' => true,
- ), $additional_form_data);
-
- return self::submit_post($posting_url, 'POST_REPLY', $form_data);
- }
-
- /**
- * Helper for submitting posts
- *
- * @param string $posting_url
- * @param string $posting_contains
- * @param array $form_data
- * @return array post_id, topic_id
- */
- protected function submit_post($posting_url, $posting_contains, $form_data)
- {
- $this->add_lang('posting');
-
- $crawler = self::request('GET', $posting_url);
- $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text());
-
- $hidden_fields = array(
- $crawler->filter('[type="hidden"]')->each(function ($node, $i) {
- return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value'));
- }),
- );
-
- foreach ($hidden_fields as $fields)
- {
- foreach($fields as $field)
- {
- $form_data[$field['name']] = $field['value'];
- }
- }
-
- // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened)
- // is not at least 2 seconds before submission, cancel the form
- $form_data['lastclick'] = 0;
-
- // I use a request because the form submission method does not allow you to send data that is not
- // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs)
- // Instead, I send it as a request with the submit button "post" set to true.
- $crawler = self::request('POST', $posting_url, $form_data);
- $this->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,
- );
- }
}
diff --git a/tests/functional/report_post_captcha.php b/tests/functional/report_post_captcha.php
new file mode 100644
index 0000000000..af713775c5
--- /dev/null
+++ b/tests/functional/report_post_captcha.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
+ *
+ */
+
+/**
+ * @group functional
+ */
+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');
+ $this->add_lang('mcp');
+ $this->assertContains($this->lang('USER_CANNOT_REPORT'), $crawler->filter('html')->text());
+
+ $this->set_reporting_guest(1);
+ $crawler = self::request('GET', 'report.php?f=2&p=1');
+ $this->assertContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text());
+ $this->set_reporting_guest(-1);
+ }
+
+ protected function set_reporting_guest($report_post_allowed)
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', 'adm/index.php?i=permissions&icat=12&mode=setting_group_local&sid=' . $this->sid);
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+ $values["group_id[0]"] = 1;
+ $form->setValues($values);
+ $crawler = self::submit($form);
+
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+ $values["forum_id"] = 2;
+ $form->setValues($values);
+ $crawler = self::submit($form);
+
+ $this->add_lang('acp/permissions');
+ $form = $crawler->selectButton($this->lang('APPLY_ALL_PERMISSIONS'))->form();
+ $values = $form->getValues();
+ $values["setting[1][2][f_report]"] = $report_post_allowed;
+ $form->setValues($values);
+ $crawler = self::submit($form);
+
+ $crawler = self::request('GET', 'ucp.php?mode=logout&sid=' . $this->sid);
+ }
+}
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/functions/get_remote_file_test.php b/tests/functions/get_remote_file_test.php
new file mode 100644
index 0000000000..4032ca5b58
--- /dev/null
+++ b/tests/functions/get_remote_file_test.php
@@ -0,0 +1,75 @@
+<?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__) . '/../../phpBB/includes/functions_admin.php';
+
+/**
+* @group slow
+*/
+class phpbb_functions_get_remote_file extends phpbb_test_case
+{
+ public function test_version_phpbb_com()
+ {
+ $hostname = 'version.phpbb.com';
+
+ if (!phpbb_checkdnsrr($hostname, 'A'))
+ {
+ $this->markTestSkipped(sprintf(
+ 'Could not find a DNS record for hostname %s. ' .
+ 'Assuming network is down.',
+ $hostname
+ ));
+ }
+
+ $errstr = $errno = null;
+ $file = get_remote_file($hostname, '/phpbb', '30x.txt', $errstr, $errno);
+
+ $this->assertNotEquals(
+ 0,
+ strlen($file),
+ 'Failed asserting that the response is not empty.'
+ );
+
+ $this->assertSame(
+ '',
+ $errstr,
+ 'Failed asserting that the error string is empty.'
+ );
+
+ $this->assertSame(
+ 0,
+ $errno,
+ 'Failed asserting that the error number is 0 (i.e. no error occurred).'
+ );
+
+ $lines = explode("\n", $file);
+
+ $this->assertGreaterThanOrEqual(
+ 2,
+ sizeof($lines),
+ 'Failed asserting that the version file has at least two lines.'
+ );
+
+ $this->assertStringStartsWith(
+ '3.',
+ $lines[0],
+ "Failed asserting that the first line of the version file starts with '3.'"
+ );
+
+ $this->assertNotSame(
+ false,
+ filter_var($lines[1], FILTER_VALIDATE_URL),
+ 'Failed asserting that the second line of the version file is a valid URL.'
+ );
+
+ $this->assertContains('http', $lines[1]);
+ $this->assertContains('phpbb.com', $lines[1], '', true);
+ }
+}
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/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/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/continue_test.php b/tests/session/continue_test.php
index ad78d92299..e5a7f7a4a1 100644
--- a/tests/session/continue_test.php
+++ b/tests/session/continue_test.php
@@ -53,7 +53,20 @@ class phpbb_session_continue_test extends phpbb_database_test_case
*/
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,
diff --git a/tests/session/init_test.php b/tests/session/creation_test.php
index 830de34ed0..fde76d6b06 100644
--- a/tests/session/init_test.php
+++ b/tests/session/creation_test.php
@@ -9,7 +9,7 @@
require_once dirname(__FILE__) . '/testable_factory.php';
-class phpbb_session_init_test extends phpbb_database_test_case
+class phpbb_session_creation_test extends phpbb_database_test_case
{
public function getDataSet()
{
@@ -20,7 +20,20 @@ class phpbb_session_init_test extends phpbb_database_test_case
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);
@@ -34,10 +47,11 @@ class phpbb_session_init_test extends phpbb_database_test_case
$this->assertSqlResultEquals(
array(array('session_user_id' => 3)),
$sql,
- 'Check if exacly one session for user id 3 was created'
+ 'Check if exactly one session for user id 3 was created'
);
- $cookie_expire = $session->time_now + 31536000; // default is one year
+ $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),
diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php
index f1012b6939..ff7b890d11 100644
--- a/tests/template/includephp_test.php
+++ b/tests/template/includephp_test.php
@@ -15,9 +15,7 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case
{
$this->setup_engine(array('tpl_allow_php' => true));
- $cache_file = $this->template->cachepath . 'includephp_relative.html.php';
-
- $this->run_template('includephp_relative.html', array(), array(), array(), "Path is relative to board root.\ntesting included php", $cache_file);
+ $this->run_template('includephp_relative.html', array(), array(), array(), "Path is relative to board root.\ntesting included php");
$this->template->set_filenames(array('test' => 'includephp_relative.html'));
$this->assertEquals("Path is relative to board root.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP");
@@ -27,9 +25,7 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case
{
$this->setup_engine(array('tpl_allow_php' => true));
- $cache_file = $this->template->cachepath . 'includephp_variables.html.php';
-
- $this->run_template('includephp_variables.html', array('TEMPLATES' => 'templates'), array(), array(), "Path includes variables.\ntesting included php", $cache_file);
+ $this->run_template('includephp_variables.html', array('TEMPLATES' => 'templates'), array(), array(), "Path includes variables.\ntesting included php");
$this->template->set_filenames(array('test' => 'includephp_variables.html'));
$this->assertEquals("Path includes variables.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP");
@@ -37,11 +33,13 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case
public function test_includephp_absolute()
{
- $path_to_php = dirname(__FILE__) . '/templates/_dummy_include.php.inc';
+ global $phpbb_root_path;
+
+ $path_to_php = str_replace('\\', '/', dirname(__FILE__)) . '/templates/_dummy_include.php.inc';
$this->assertTrue(phpbb_is_absolute($path_to_php));
$template_text = "Path is absolute.\n<!-- INCLUDEPHP $path_to_php -->";
- $cache_dir = dirname($this->template->cachepath) . '/';
+ $cache_dir = $phpbb_root_path . 'cache/';
$fp = fopen($cache_dir . 'includephp_absolute.html', 'w');
fputs($fp, $template_text);
fclose($fp);
@@ -49,9 +47,8 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case
$this->setup_engine(array('tpl_allow_php' => true));
$this->style->set_custom_style('tests', $cache_dir, array(), '');
- $cache_file = $this->template->cachepath . 'includephp_absolute.html.php';
- $this->run_template('includephp_absolute.html', array(), array(), array(), "Path is absolute.\ntesting included php", $cache_file);
+ $this->run_template('includephp_absolute.html', array(), array(), array(), "Path is absolute.\ntesting included php");
$this->template->set_filenames(array('test' => 'includephp_absolute.html'));
$this->assertEquals("Path is absolute.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP");
diff --git a/tests/template/invalid_constructs_test.php b/tests/template/invalid_constructs_test.php
deleted file mode 100644
index 19d192b8b6..0000000000
--- a/tests/template/invalid_constructs_test.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?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__) . '/template_test_case.php';
-
-class phpbb_template_invalid_constructs_test extends phpbb_template_template_test_case
-{
- public function template_data()
- {
- return array(
- array(
- 'Unknown tag',
- 'invalid/unknown_tag.html',
- array(),
- array(),
- array(),
- 'invalid/output/unknown_tag.html',
- ),
- /*
- * Produces a parse error which is fatal, therefore
- * destroying the test suite.
- array(
- 'ENDIF without IF',
- 'invalid/endif_without_if.html',
- array(),
- array(),
- array(),
- 'invalid/output/endif_without_if.html',
- ),
- */
- );
- }
-
- public function template_data_error()
- {
- return array(
- array(
- 'Include a nonexistent file',
- 'invalid/include_nonexistent_file.html',
- array(),
- array(),
- array(),
- E_USER_ERROR,
- 'invalid/output/include_nonexistent_file.html',
- ),
- );
- }
-
- /**
- * @dataProvider template_data
- */
- public function test_template($description, $file, $vars, $block_vars, $destroy, $expected)
- {
- $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php';
-
- $this->assertFileNotExists($cache_file);
-
- $expected = file_get_contents(dirname(__FILE__) . '/templates/' . $expected);
- // apparently the template engine does not put
- // the trailing newline into compiled templates
- $expected = trim($expected);
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
- }
-
- /**
- * @dataProvider template_data_error
- */
- public function test_template_error($description, $file, $vars, $block_vars, $destroy, $error, $expected)
- {
- $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php';
-
- $this->assertFileNotExists($cache_file);
-
- $expected = file_get_contents(dirname(__FILE__) . '/templates/' . $expected);
- // apparently the template engine does not put
- // the trailing newline into compiled templates
- $expected = trim($expected);
- $this->setExpectedTriggerError($error, $expected);
- $this->run_template($file, $vars, $block_vars, $destroy, '', $cache_file);
- }
-}
diff --git a/tests/template/parent_templates/parent_only.css b/tests/template/parent_templates/parent_only.css
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/template/parent_templates/parent_only.css
diff --git a/tests/template/renderer_eval_test.php b/tests/template/renderer_eval_test.php
deleted file mode 100644
index 7ebb8b9bda..0000000000
--- a/tests/template/renderer_eval_test.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-class phpbb_template_renderer_eval_test extends phpbb_test_case
-{
- public function test_eval()
- {
- $compiled_code = '<a href="<?php echo \'Test\'; ?>">';
- $valid_code = '<a href="Test">';
- $context = new phpbb_template_context();
- $template = new phpbb_template_renderer_eval($compiled_code, NULL);
- ob_start();
- try
- {
- $template->render($context, array());
- }
- catch (Exception $exception)
- {
- ob_end_clean();
- throw $exception;
- }
- $output = ob_get_clean();
- $this->assertEquals($valid_code, $output);
- }
-}
diff --git a/tests/template/subdir/includephp_from_subdir_test.php b/tests/template/subdir/includephp_from_subdir_test.php
index 517cb85a30..6f9bc1efa6 100644
--- a/tests/template/subdir/includephp_from_subdir_test.php
+++ b/tests/template/subdir/includephp_from_subdir_test.php
@@ -19,9 +19,7 @@ class phpbb_template_subdir_includephp_from_subdir_test extends phpbb_template_t
{
$this->setup_engine(array('tpl_allow_php' => true));
- $cache_file = $this->template->cachepath . 'includephp_relative.html.php';
-
- $this->run_template('includephp_relative.html', array(), array(), array(), "Path is relative to board root.\ntesting included php", $cache_file);
+ $this->run_template('includephp_relative.html', array(), array(), array(), "Path is relative to board root.\ntesting included php");
$this->template->set_filenames(array('test' => 'includephp_relative.html'));
$this->assertEquals("Path is relative to board root.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP");
diff --git a/tests/template/template_compile_test.php b/tests/template/template_compile_test.php
deleted file mode 100644
index 7393fc1747..0000000000
--- a/tests/template/template_compile_test.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-
-class phpbb_template_template_compile_test extends phpbb_test_case
-{
- private $template_compile;
- private $template_path;
-
- protected function setUp()
- {
- $this->template_compile = new phpbb_template_compile(false, null, $this->style_resource_locator, '');
- $this->template_path = dirname(__FILE__) . '/templates';
- }
-
- public function test_in_phpbb()
- {
- $output = $this->template_compile->compile_file($this->template_path . '/trivial.html');
- $this->assertTrue(strlen($output) > 0);
- $statements = explode(';', $output);
- $first_statement = $statements[0];
- $this->assertTrue(!!preg_match('#if.*defined.*IN_PHPBB.*exit#', $first_statement));
- }
-}
diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php
index 0ac50c7f2b..f7bcd2dcc6 100644
--- a/tests/template/template_events_test.php
+++ b/tests/template/template_events_test.php
@@ -54,11 +54,9 @@ class phpbb_template_template_events_test extends phpbb_template_template_test_c
array(),
array(),
array(),
-'Kappa test event in all
-Omega test event in all
-Zeta test event in all
-Kappa test event in silver
-Omega test event in silver',
+'Kappa test event in silver
+Omega test event in silver
+Zeta test event in all',
),
array(
'Template event with inheritance - child',
@@ -68,10 +66,9 @@ Omega test event in silver',
array(),
array(),
array(),
-'Kappa test event in all
-Omega test event in all
-Zeta test event in all
-Kappa test event in silver_inherit',
+'Kappa test event in silver_inherit
+Omega test event in silver
+Zeta test event in all',
),
array(
'Definition in parent style',
@@ -95,8 +92,7 @@ Kappa test event in silver_inherit',
$this->setup_engine_for_events($dataset, $style_names);
// Run test
- $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php';
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
+ $this->run_template($file, $vars, $block_vars, $destroy, $expected);
}
protected function setup_engine_for_events($dataset, $style_names, array $new_config = array())
@@ -111,7 +107,7 @@ Kappa test event in silver_inherit',
$this->extension_manager = new phpbb_mock_filesystem_extension_manager(
dirname(__FILE__) . "/datasets/$dataset/"
);
- $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, new phpbb_template_context, $this->extension_manager);
+ $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context, $this->extension_manager);
$this->style_provider = new phpbb_style_path_provider();
$this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
$this->style->set_custom_style('silver', array($this->template_path), $style_names, '');
diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php
new file mode 100644
index 0000000000..f8999ad1a9
--- /dev/null
+++ b/tests/template/template_includecss_test.php
@@ -0,0 +1,28 @@
+<?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__) . '/template_test_case_with_tree.php';
+
+class phpbb_template_template_includecss_test extends phpbb_template_template_test_case_with_tree
+{
+ public function test_includecss_compilation()
+ {
+ // Reset the engine state
+ $this->setup_engine(array('assets_version' => 1));
+
+ // Prepare correct result
+ $scripts = array(
+ '<link href="' . $this->test_path . '/templates/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />',
+ '<link href="' . $this->test_path . '/parent_templates/parent_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />',
+ );
+
+ // Run test
+ $this->run_template('includecss.html', array(), array(), array(), implode('', $scripts));
+ }
+}
diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php
index 22b020208b..b67fa123a1 100644
--- a/tests/template/template_includejs_test.php
+++ b/tests/template/template_includejs_test.php
@@ -11,23 +11,93 @@ require_once dirname(__FILE__) . '/template_test_case_with_tree.php';
class phpbb_template_template_includejs_test extends phpbb_template_template_test_case_with_tree
{
- public function test_includejs_compilation()
+ public function template_data()
+ {
+ return array(
+ /*
+ array(
+ // vars
+ // expected
+ ),
+ */
+ array(
+ array('TEST' => 1),
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?assets_version=1"></script>',
+ ),
+ array(
+ array('TEST' => 2),
+ '<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"></script>',
+ ),
+ array(
+ array('TEST' => 4),
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&amp;assets_version=0"></script>',
+ ),
+ array(
+ array('TEST' => 6),
+ '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?assets_version=1"></script>',
+ ),
+ array(
+ array('TEST' => 7),
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/child_only.js?assets_version=1"></script>',
+ ),
+ array(
+ array('TEST' => 8),
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/subdir/parent_only.js?assets_version=1"></script>',
+ ),
+ array(
+ array('TEST' => 9),
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/subdir/subsubdir/parent_only.js?assets_version=1"></script>',
+ ),
+ array(
+ array('TEST' => 10),
+ '<script type="text/javascript" src="' . $this->test_path . '/templates/subdir/parent_only.js?assets_version=1"></script>',
+ ),
+ array(
+ array('TEST' => 11),
+ '<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&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;&amp;assets_version=1#test3"></script>',
+ ),
+ array(
+ array('TEST' => 15),
+ '<script type="text/javascript" src="http://phpbb.com/b.js?c=d#f"></script>',
+ ),
+ array(
+ array('TEST' => 16),
+ '<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>',
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider template_data
+ */
+ public function test_includejs_compilation($vars, $expected)
{
// Reset the engine state
$this->setup_engine(array('assets_version' => 1));
- // Prepare correct result
- $scripts = array(
- '<script src="' . $this->test_path . '/templates/parent_and_child.js?assets_version=1"></script>',
- '<script src="' . $this->test_path . '/parent_templates/parent_only.js?assets_version=1"></script>',
- '<script src="' . $this->test_path . '/templates/child_only.js?assets_version=1"></script>',
- '<script src="' . $this->test_path . '/templates/subdir/parent_only.js?assets_version=1"></script>',
- '<script src="' . $this->test_path . '/templates/subdir/subsubdir/parent_only.js?assets_version=1"></script>',
- '<script src="' . $this->test_path . '/templates/subdir/parent_only.js?assets_version=1"></script>',
- );
+ $this->template->assign_vars($vars);
// Run test
- $cache_file = $this->template->cachepath . 'includejs.html.php';
- $this->run_template('includejs.html', array('PARENT' => 'parent_only.js', 'SUBDIR' => 'subdir', 'EXT' => 'js'), array(), array(), implode('', $scripts), $cache_file);
+ $this->run_template('includejs.html', array_merge(array('PARENT' => 'parent_only.js', 'SUBDIR' => 'subdir', 'EXT' => 'js'), $vars), array(), array(), $expected);
}
}
diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php
index febfed9ef0..cc71ff99e0 100644
--- a/tests/template/template_inheritance_test.php
+++ b/tests/template/template_inheritance_test.php
@@ -50,15 +50,6 @@ class phpbb_template_template_inheritance_test extends phpbb_template_template_t
*/
public function test_template($name, $file, array $vars, array $block_vars, array $destroy, $expected)
{
- $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php';
-
- $this->assertFileNotExists($cache_file);
-
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
-
- // Reset the engine state
- $this->setup_engine();
-
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
+ $this->run_template($file, $vars, $block_vars, $destroy, $expected);
}
}
diff --git a/tests/template/template_locate_test.php b/tests/template/template_locate_test.php
deleted file mode 100644
index 851dcae8ea..0000000000
--- a/tests/template/template_locate_test.php
+++ /dev/null
@@ -1,68 +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__) . '/template_test_case_with_tree.php';
-
-class phpbb_template_template_locate_test extends phpbb_template_template_test_case_with_tree
-{
- public function template_data()
- {
- return array(
- // First element of the array is test name - keep them distinct
- array(
- 'simple inheritance - only parent template exists',
- $this->test_path . '/parent_templates/parent_only.html',
- 'parent_only.html',
- false,
- true,
- ),
- array(
- 'simple inheritance - only child template exists',
- $this->test_path . '/templates/child_only.html',
- 'child_only.html',
- false,
- true,
- ),
- array(
- 'simple inheritance - both parent and child templates exist',
- $this->test_path . '/templates/parent_and_child.html',
- 'parent_and_child.html',
- false,
- true,
- ),
- array(
- 'find first template - only child template exists in main style',
- 'child_only.html',
- array('parent_only.html', 'child_only.html'),
- false,
- false,
- ),
- array(
- 'find first template - both templates exist in main style',
- 'parent_and_child.html',
- array('parent_and_child.html', 'child_only.html'),
- false,
- false,
- ),
- );
- }
-
- /**
- * @dataProvider template_data
- */
- public function test_template($name, $expected, $files, $return_default, $return_full_path)
- {
- // Reset the engine state
- $this->setup_engine();
-
- // Locate template
- $result = $this->style_resource_locator->get_first_template_location($files, $return_default, $return_full_path);
- $this->assertSame($expected, $result);
- }
-}
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_spacing_test.php b/tests/template/template_spacing_test.php
deleted file mode 100644
index 83f8711b38..0000000000
--- a/tests/template/template_spacing_test.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2013 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-require_once dirname(__FILE__) . '/template_test_case.php';
-
-class phpbb_template_template_spacing_test extends phpbb_template_template_test_case
-{
- public function template_data()
- {
- return array(
- /*
- array(
- '', // Description
- '', // dataset
- array(), // style names
- '', // file
- array(), // vars
- array(), // block vars
- array(), // destroy
- '', // expected result
- ),
- */
- array(
- 'Spacing in templates',
- 'ext_trivial',
- array(),
- 'variable_spacing.html',
- array(
- 'VARIABLE' => '{}',
- ),
- array(),
- array(),
- '|{}|
-{}|{}|
-|{}
-<div class="{}">test</div>',
- ),
- );
- }
-
- /**
- * @dataProvider template_data
- */
- public function test_template($desc, $dataset, $style_names, $file, array $vars, array $block_vars, array $destroy, $expected)
- {
- // Run test
- $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php';
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
- }
-
- /**
- * @dataProvider template_data
- */
- public function test_event($desc, $dataset, $style_names, $file, array $vars, array $block_vars, array $destroy, $expected)
- {
- // Reset the engine state
- $this->setup_engine_for_events($dataset, $style_names);
-
- // Run test
- $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php';
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
- }
-
- protected function setup_engine_for_events($dataset, $style_names, array $new_config = array())
- {
- global $phpbb_root_path, $phpEx, $user;
-
- $defaults = $this->config_defaults();
- $config = new phpbb_config(array_merge($defaults, $new_config));
-
- $this->template_path = dirname(__FILE__) . "/datasets/$dataset/styles/silver/template";
- $this->style_resource_locator = new phpbb_style_resource_locator();
- $this->extension_manager = new phpbb_mock_filesystem_extension_manager(
- dirname(__FILE__) . "/datasets/$dataset/"
- );
- $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, new phpbb_template_context, $this->extension_manager);
- $this->style_provider = new phpbb_style_path_provider();
- $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
- $this->style->set_custom_style('silver', array($this->template_path), $style_names, '');
- }
-}
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index a3c0b69123..802f0c19ba 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -46,28 +46,42 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(),
array(),
array(),
- '03',
+ '03!false',
),
array(
'if.html',
array('S_VALUE' => true),
array(),
array(),
- '1',
+ '1!false',
),
array(
'if.html',
array('S_VALUE' => true, 'S_OTHER_VALUE' => true),
array(),
array(),
- '1',
+ '1!false',
),
array(
'if.html',
array('S_VALUE' => false, 'S_OTHER_VALUE' => true),
array(),
array(),
- '2',
+ '2!false',
+ ),
+ array(
+ 'if.html',
+ array('S_TEST' => false),
+ array(),
+ array(),
+ '03false',
+ ),
+ array(
+ 'if.html',
+ array('S_TEST' => 0),
+ array(),
+ array(),
+ '03!false',
),
array(
'loop.html',
@@ -116,7 +130,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(),
array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
array(),
- "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner\ninner loop",
+ "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner",
),
array(
'loop_advanced.html',
@@ -126,6 +140,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
"101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561",
),
array(
+ 'loop_nested2.html',
+ array(),
+ array('outer' => array(array(), array()), 'outer.middle' => array(array(), array())),
+ array(),
+ "o0o1m01m11",
+ ),
+ array(
'define.html',
array(),
array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
@@ -140,13 +161,6 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
"abc\nzxc\ncde\nbcd",
),
array(
- 'define_unclosed.html',
- array(),
- array(),
- array(),
- "test",
- ),
- array(
'expressions.html',
array(),
array(),
@@ -247,21 +261,15 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(),
array(),
array(),
- "{ VARIABLE }\n{ 1_VARIABLE }\n{ VARIABLE }\n{ 1_VARIABLE }",
+ "VARIABLE\n1_VARIABLE\nVARIABLE\n1_VARIABLE",
),
array(
'lang.html',
- array('L_VARIABLE' => "Value'", 'L_1_VARIABLE' => "1 O'Clock"),
array(),
array(),
- "Value'\n1 O'Clock\nValue\'\n1 O\'Clock",
- ),
- array(
- 'lang.html',
- array('LA_VARIABLE' => "Value'", 'LA_1_VARIABLE' => "1 O'Clock"),
- array(),
array(),
- "{ VARIABLE }\n{ 1_VARIABLE }\nValue'\n1 O'Clock",
+ "Value'\n1 O'Clock\nValue\'\n1 O\'Clock",
+ array('VARIABLE' => "Value'", '1_VARIABLE' => "1 O'Clock"),
),
array(
'loop_nested_multilevel_ref.html',
@@ -275,7 +283,6 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(),
array('outer' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'outer.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))),
array(),
- // I don't completely understand this output, hopefully it's correct
"top-level content\nouter x\nouter y\ninner z\nfirst row\n\ninner zz",
),
array(
@@ -283,7 +290,6 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(),
array('outer' => array(array()), 'outer.middle' => array(array()), 'outer.middle.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))),
array(),
- // I don't completely understand this output, hopefully it's correct
"top-level content\nouter\nmiddle\ninner z\nfirst row of 2 in inner\n\ninner zz",
),
array(
@@ -303,6 +309,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
"a\nb\nc\nd",
),
*/
+ array(
+ 'twig.html',
+ array('VARIABLE' => 'FOObar',),
+ array(),
+ array(),
+ "13FOOBAR|foobar",
+ ),
);
}
@@ -313,24 +326,15 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
$this->template->set_filenames(array('test' => $filename));
$this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist');
- $expecting = sprintf('style resource locator: File for handle test does not exist. Could not find: %s', $this->test_path . '/templates/' . $filename);
- $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
+ $this->setExpectedException('Twig_Error_Loader');
$this->display('test');
}
- public function test_empty_file()
- {
- $expecting = 'style resource locator: set_filenames: Empty filename specified for test';
-
- $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
- $this->template->set_filenames(array('test' => ''));
- }
public function test_invalid_handle()
{
- $expecting = 'No file specified for handle test';
- $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
+ $this->setExpectedException('Twig_Error_Loader');
$this->display('test');
}
@@ -338,49 +342,23 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
/**
* @dataProvider template_data
*/
- public function test_template($file, array $vars, array $block_vars, array $destroy, $expected)
+ public function test_template($file, array $vars, array $block_vars, array $destroy, $expected, $lang_vars = array())
{
- $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.php';
-
- $this->assertFileNotExists($cache_file);
-
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
-
- // Reset the engine state
- $this->setup_engine();
-
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
+ $this->run_template($file, $vars, $block_vars, $destroy, $expected, $lang_vars);
}
- /**
- * @dataProvider template_data
- */
- public function test_assign_display($file, array $vars, array $block_vars, array $destroy, $expected)
+ public function test_assign_display()
{
+ $this->run_template('basic.html', array(), array(), array(), "pass\npass\npass\n<!-- DUMMY var -->");
+
$this->template->set_filenames(array(
- 'test' => $file,
- 'container' => 'variable.html',
+ 'test' => 'basic.html',
+ 'container' => 'variable.html',
));
- $this->template->assign_vars($vars);
-
- foreach ($block_vars as $block => $loops)
- {
- foreach ($loops as $_vars)
- {
- $this->template->assign_block_vars($block, $_vars);
- }
- }
-
- foreach ($destroy as $block)
- {
- $this->template->destroy_block_vars($block);
- }
-
- $this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)");
$this->template->assign_display('test', 'VARIABLE', false);
- $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)");
+ $this->assertEquals("pass\npass\npass\n<!-- DUMMY var -->", $this->display('container'), "Testing assign_display($file)");
}
public function test_append_var_without_assign_var()
@@ -391,7 +369,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
$items = array('This ', 'is ', 'a ', 'test');
$expecting = implode('', $items);
-
+
foreach ($items as $word)
{
$this->template->append_var('VARIABLE', $word);
@@ -409,7 +387,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
$start = 'This ';
$items = array('is ', 'a ', 'test');
$expecting = $start . implode('', $items);
-
+
$this->template->assign_var('VARIABLE', $start);
foreach ($items as $word)
{
@@ -421,13 +399,20 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
public function test_php()
{
- $this->setup_engine(array('tpl_allow_php' => true));
+ global $phpbb_root_path;
- $cache_file = $this->template->cachepath . 'php.html.php';
+ $template_text = '<!-- PHP -->echo "test";<!-- ENDPHP -->';
- $this->assertFileNotExists($cache_file);
+ $cache_dir = $phpbb_root_path . 'cache/';
+ $fp = fopen($cache_dir . 'php.html', 'w');
+ fputs($fp, $template_text);
+ fclose($fp);
- $this->run_template('php.html', array(), array(), array(), 'test', $cache_file);
+ $this->setup_engine(array('tpl_allow_php' => true));
+
+ $this->style->set_custom_style('tests', $cache_dir, array(), '');
+
+ $this->run_template('php.html', array(), array(), array(), 'test');
}
public function alter_block_array_data()
@@ -533,10 +518,40 @@ EOT
$this->template->assign_block_vars('outer.middle', array());
$this->template->assign_block_vars('outer.middle', array());
- $this->assertEquals("outer - 0\nmiddle - 0\nmiddle - 1\nouter - 1\nmiddle - 0\nmiddle - 1\nouter - 2\nmiddle - 0\nmiddle - 1", $this->display('test'), 'Ensuring template is built correctly before modification');
+ $this->assertEquals("outer - 0middle - 0middle - 1outer - 1middle - 0middle - 1outer - 2middle - 0middle - 1", $this->display('test'), 'Ensuring template is built correctly before modification');
$this->template->alter_block_array($alter_block, $vararray, $key, $mode);
- $this->assertEquals($expect, $this->display('test'), $description);
+ $this->assertEquals(str_replace(array("\n", "\r", "\t"), '', $expect), str_replace(array("\n", "\r", "\t"), '', $this->display('test')), $description);
}
+ public function test_more_alter_block_array()
+ {
+ $this->template->set_filenames(array('test' => 'loop_nested.html'));
+
+ $this->template->assign_var('TEST_MORE', true);
+
+ // @todo Change this
+ $this->template->assign_block_vars('outer', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer.middle', array());
+
+ $expect = 'outer - 0[outer|3]middle - 0[middle|1]outer - 1[outer|3]middle - 0[middle|2]middle - 1[middle|2]outer - 2[outer|3]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]';
+ $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring template is built correctly before modification');
+
+ $this->template->alter_block_array('outer', array());
+
+ $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]';
+ $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after insertion');
+
+ $this->template->alter_block_array('outer', array('VARIABLE' => 'test'), 2, 'change');
+
+ $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]';
+ $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification');
+ }
}
diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php
index 3c997cb00e..6d87e5ebc0 100644
--- a/tests/template/template_test_case.php
+++ b/tests/template/template_test_case.php
@@ -16,6 +16,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
protected $template_path;
protected $style_resource_locator;
protected $style_provider;
+ protected $user;
protected $test_path = 'tests/template';
@@ -28,11 +29,11 @@ class phpbb_template_template_test_case extends phpbb_test_case
try
{
- $this->assertTrue($this->template->display($handle, false));
+ $this->template->display($handle, false);
}
catch (Exception $exception)
{
- // reset output buffering even when an error occured
+ // reset output buffering even when an error occurred
// PHPUnit turns trigger_error into exceptions as well
ob_end_clean();
throw $exception;
@@ -59,16 +60,17 @@ class phpbb_template_template_test_case extends phpbb_test_case
protected function setup_engine(array $new_config = array())
{
- global $phpbb_root_path, $phpEx, $user;
+ global $phpbb_root_path, $phpEx;
$defaults = $this->config_defaults();
$config = new phpbb_config(array_merge($defaults, $new_config));
+ $this->user = new phpbb_user;
$this->template_path = $this->test_path . '/templates';
$this->style_resource_locator = new phpbb_style_resource_locator();
$this->style_provider = new phpbb_style_path_provider();
- $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, new phpbb_template_context());
- $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
+ $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context());
+ $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, $this->style_provider, $this->template);
$this->style->set_custom_style('tests', $this->template_path, array(), '');
}
@@ -77,32 +79,18 @@ class phpbb_template_template_test_case extends phpbb_test_case
// Test the engine can be used
$this->setup_engine();
- $template_cache_dir = dirname($this->template->cachepath);
- if (!is_writable($template_cache_dir))
- {
- $this->markTestSkipped("Template cache directory ({$template_cache_dir}) is not writable.");
- }
-
- foreach (glob($this->template->cachepath . '*') as $file)
- {
- unlink($file);
- }
-
- $this->setup_engine();
+ $this->template->clear_cache();
}
protected function tearDown()
{
- if (is_object($this->template))
+ if ($this->template)
{
- foreach (glob($this->template->cachepath . '*') as $file)
- {
- unlink($file);
- }
+ $this->template->clear_cache();
}
}
- protected function run_template($file, array $vars, array $block_vars, array $destroy, $expected, $cache_file)
+ protected function run_template($file, array $vars, array $block_vars, array $destroy, $expected, $lang_vars = array())
{
$this->template->set_filenames(array('test' => $file));
$this->template->assign_vars($vars);
@@ -120,25 +108,17 @@ class phpbb_template_template_test_case extends phpbb_test_case
$this->template->destroy_block_vars($block);
}
- try
+ // Previous functionality was $cachefile (string), which was removed, check to prevent errors
+ if (is_array($lang_vars))
{
- $this->assertEquals($expected, $this->display('test'), "Testing $file");
- $this->assertFileExists($cache_file);
- }
- catch (ErrorException $e)
- {
- if (file_exists($cache_file))
+ foreach ($lang_vars as $name => $value)
{
- copy($cache_file, str_replace('ctpl_', 'tests_ctpl_', $cache_file));
+ $this->user->lang[$name] = $value;
}
- throw $e;
}
- // For debugging.
- // When testing eval path the cache file may not exist.
- if (self::PRESERVE_CACHE && file_exists($cache_file))
- {
- copy($cache_file, str_replace('ctpl_', 'tests_ctpl_', $cache_file));
- }
+ $expected = str_replace(array("\n", "\r", "\t"), '', $expected);
+ $output = str_replace(array("\n", "\r", "\t"), '', $this->display('test'));
+ $this->assertEquals($expected, $output, "Testing $file");
}
}
diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php
index 7585be5728..4b8cbada45 100644
--- a/tests/template/template_test_case_with_tree.php
+++ b/tests/template/template_test_case_with_tree.php
@@ -22,7 +22,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
$this->parent_template_path = $this->test_path . '/parent_templates';
$this->style_resource_locator = new phpbb_style_resource_locator();
$this->style_provider = new phpbb_style_path_provider();
- $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, new phpbb_template_context());
+ $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context());
$this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
$this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), array(), '');
}
diff --git a/tests/template/templates/child_only.css b/tests/template/templates/child_only.css
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/template/templates/child_only.css
diff --git a/tests/template/templates/define_unclosed.html b/tests/template/templates/define_unclosed.html
deleted file mode 100644
index 1c975eab2b..0000000000
--- a/tests/template/templates/define_unclosed.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<!-- DEFINE $VALUE -->
-test
diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html
index eed431019e..c010aff7fa 100644
--- a/tests/template/templates/if.html
+++ b/tests/template/templates/if.html
@@ -9,3 +9,11 @@
<!-- IF S_VALUE and S_OTHER_VALUE and (S_VALUE > S_OTHER_VALUE) -->
04
<!-- ENDIF -->
+
+<!-- IF S_TEST === false -->
+false
+<!-- ENDIF -->
+
+<!-- IF S_TEST !== false -->
+!false
+<!-- ENDIF -->
diff --git a/tests/template/templates/includecss.html b/tests/template/templates/includecss.html
new file mode 100644
index 0000000000..a09e44f240
--- /dev/null
+++ b/tests/template/templates/includecss.html
@@ -0,0 +1,3 @@
+<!-- INCLUDECSS child_only.css -->
+<!-- INCLUDECSS parent_only.css -->
+{$STYLESHEETS}
diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html
index ef73700eeb..0bcdf1a815 100644
--- a/tests/template/templates/includejs.html
+++ b/tests/template/templates/includejs.html
@@ -1,8 +1,36 @@
-<!-- INCLUDEJS parent_and_child.js -->
-<!-- INCLUDEJS {PARENT} -->
-<!-- DEFINE $TEST = 'child_only.js' -->
-<!-- INCLUDEJS {$TEST} -->
-<!-- INCLUDEJS subdir/{PARENT} -->
-<!-- INCLUDEJS {SUBDIR}/subsubdir/{PARENT} -->
-<!-- INCLUDEJS {SUBDIR}/parent_only.{EXT} -->
-{SCRIPTS}
+<!-- IF TEST === 1 -->
+ <!-- INCLUDEJS parent_and_child.js -->
+<!-- ELSEIF TEST === 2 -->
+ <!-- INCLUDEJS parent_and_child.js?assets_version=0 -->
+<!-- ELSEIF TEST === 3 -->
+ <!-- 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 === 6 -->
+ <!-- INCLUDEJS {PARENT} -->
+<!-- ELSEIF TEST === 7 -->
+ <!-- DEFINE $TEST = 'child_only.js' -->
+ <!-- INCLUDEJS {$TEST} -->
+<!-- ELSEIF TEST === 8 -->
+ <!-- INCLUDEJS subdir/{PARENT} -->
+<!-- ELSEIF TEST === 9 -->
+ <!-- INCLUDEJS {SUBDIR}/subsubdir/{PARENT} -->
+<!-- ELSEIF TEST === 10 -->
+ <!-- INCLUDEJS {SUBDIR}/parent_only.{EXT} -->
+<!-- ELSEIF TEST === 11 -->
+ <!-- DEFINE $TEST = 'child_only.js?test1=1&amp;test2=2#test3' -->
+ <!-- INCLUDEJS {$TEST} -->
+<!-- ELSEIF TEST === 12 -->
+ <!-- INCLUDEJS parent_only.js?test1=1&amp;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=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/template/templates/invalid/include_nonexistent_file.html b/tests/template/templates/invalid/include_nonexistent_file.html
deleted file mode 100644
index 617d2fdaaa..0000000000
--- a/tests/template/templates/invalid/include_nonexistent_file.html
+++ /dev/null
@@ -1 +0,0 @@
-<!-- INCLUDE nonexistent.html -->
diff --git a/tests/template/templates/invalid/unknown_tag.html b/tests/template/templates/invalid/unknown_tag.html
deleted file mode 100644
index 1489e5e31a..0000000000
--- a/tests/template/templates/invalid/unknown_tag.html
+++ /dev/null
@@ -1 +0,0 @@
-<!-- UNKNOWNTAG variable.html -->
diff --git a/tests/template/templates/loop_nested.html b/tests/template/templates/loop_nested.html
index 45b1ef85d4..cf099ecc15 100644
--- a/tests/template/templates/loop_nested.html
+++ b/tests/template/templates/loop_nested.html
@@ -1,6 +1,6 @@
<!-- BEGIN outer -->
- outer - {outer.S_ROW_COUNT}<!-- IF outer.VARIABLE --> - {outer.VARIABLE}<!-- ENDIF -->
- <!-- BEGIN middle -->
- middle - {middle.S_ROW_COUNT}<!-- IF middle.VARIABLE --> - {middle.VARIABLE}<!-- ENDIF -->
- <!-- END middle -->
+outer - {outer.S_ROW_COUNT}<!-- IF outer.VARIABLE --> - {outer.VARIABLE}<!-- ENDIF --><!-- IF TEST_MORE -->[{outer.S_BLOCK_NAME}|{outer.S_NUM_ROWS}]<!-- ENDIF -->
+<!-- BEGIN middle -->
+middle - {outer.middle.S_ROW_COUNT}<!-- IF outer.middle.VARIABLE --> - {outer.middle.VARIABLE}<!-- ENDIF --><!-- IF TEST_MORE -->[{outer.middle.S_BLOCK_NAME}|{outer.middle.S_NUM_ROWS}]<!-- ENDIF -->
+<!-- END middle -->
<!-- END outer -->
diff --git a/tests/template/templates/loop_nested2.html b/tests/template/templates/loop_nested2.html
new file mode 100644
index 0000000000..3eeeb5e36a
--- /dev/null
+++ b/tests/template/templates/loop_nested2.html
@@ -0,0 +1,6 @@
+<!-- BEGIN outer -->
+o{outer.S_ROW_COUNT}
+<!-- BEGIN middle -->
+m{outer.middle.S_ROW_COUNT}{outer.S_ROW_COUNT}
+<!-- END middle -->
+<!-- END outer -->
diff --git a/tests/template/templates/loop_size.html b/tests/template/templates/loop_size.html
index f1938441df..8f581cef10 100644
--- a/tests/template/templates/loop_size.html
+++ b/tests/template/templates/loop_size.html
@@ -36,4 +36,4 @@
<!-- BEGIN loop -->
in loop
-<!-- END -->
+<!-- END loop -->
diff --git a/tests/template/templates/loop_underscore.html b/tests/template/templates/loop_underscore.html
index dafce5dea6..4001007868 100644
--- a/tests/template/templates/loop_underscore.html
+++ b/tests/template/templates/loop_underscore.html
@@ -2,7 +2,7 @@
loop
<!-- BEGINELSE -->
noloop
-<!-- END loop -->
+<!-- END _underscore_loop -->
<!-- IF ._underscore_loop -->
loop
diff --git a/tests/template/templates/loop_vars.html b/tests/template/templates/loop_vars.html
index d94a0ae0f7..7d86d4b7b6 100644
--- a/tests/template/templates/loop_vars.html
+++ b/tests/template/templates/loop_vars.html
@@ -11,4 +11,3 @@ last
<!-- IF inner.S_LAST_ROW and inner.S_ROW_COUNT and inner.S_NUM_ROWS -->last inner<!-- ENDIF -->
<!-- END inner -->
<!-- END loop -->
-<!-- IF .loop.inner -->inner loop<!-- ENDIF -->
diff --git a/tests/template/templates/twig.html b/tests/template/templates/twig.html
new file mode 100644
index 0000000000..17b94ad8d4
--- /dev/null
+++ b/tests/template/templates/twig.html
@@ -0,0 +1,6 @@
+<!-- EXTENDS "twig_parent.html" -->
+
+<!-- BLOCK overwritten -->
+3{VARIABLE|upper}|{VARIABLE|lower}
+<!-- ENDBLOCK -->
+
diff --git a/tests/template/templates/twig_parent.html b/tests/template/templates/twig_parent.html
new file mode 100644
index 0000000000..e9863221e1
--- /dev/null
+++ b/tests/template/templates/twig_parent.html
@@ -0,0 +1,7 @@
+<!-- BLOCK notoverwritten -->
+1
+<!-- ENDBLOCK -->
+
+<!-- BLOCK overwritten -->
+2
+<!-- ENDBLOCK -->
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 97fe147d8e..ed307c3ce2 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -219,15 +219,19 @@ class phpbb_functional_test_case extends phpbb_test_case
self::recreate_database(self::$config);
- if (file_exists($phpbb_root_path . "config.$phpEx"))
+ $config_file = $phpbb_root_path . "config.$phpEx";
+ $config_file_dev = $phpbb_root_path . "config_dev.$phpEx";
+ $config_file_test = $phpbb_root_path . "config_test.$phpEx";
+
+ if (file_exists($config_file))
{
- if (!file_exists($phpbb_root_path . "config_dev.$phpEx"))
+ if (!file_exists($config_file_dev))
{
- rename($phpbb_root_path . "config.$phpEx", $phpbb_root_path . "config_dev.$phpEx");
+ rename($config_file, $config_file_dev);
}
else
{
- unlink($phpbb_root_path . "config.$phpEx");
+ unlink($config_file);
}
}
@@ -251,10 +255,12 @@ class phpbb_functional_test_case extends phpbb_test_case
self::assertContains('Welcome to Installation', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form();
+ // install/index.php?mode=install&sub=requirements
$crawler = self::submit($form);
self::assertContains('Installation compatibility', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form();
+ // install/index.php?mode=install&sub=database
$crawler = self::submit($form);
self::assertContains('Database configuration', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form(array(
@@ -268,10 +274,12 @@ class phpbb_functional_test_case extends phpbb_test_case
'table_prefix' => self::$config['table_prefix'],
));
+ // install/index.php?mode=install&sub=database
$crawler = self::submit($form);
self::assertContains('Successful connection', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form();
+ // install/index.php?mode=install&sub=administrator
$crawler = self::submit($form);
self::assertContains('Administrator configuration', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form(array(
@@ -282,16 +290,38 @@ class phpbb_functional_test_case extends phpbb_test_case
'board_email' => 'nobody@example.com',
));
+ // install/index.php?mode=install&sub=administrator
$crawler = self::submit($form);
self::assertContains('Tests passed', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form();
- $crawler = self::submit($form);
- self::assertContains('The configuration file has been written.', $crawler->filter('#main')->text());
- file_put_contents($phpbb_root_path . "config.$phpEx", phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, true));
- $form = $crawler->selectButton('submit')->form();
+ // We have to skip install/index.php?mode=install&sub=config_file
+ // because that step will create a config.php file if phpBB has the
+ // permission to do so. We have to create the config file on our own
+ // in order to get the DEBUG constants defined.
+ $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, true);
+ $config_created = file_put_contents($config_file, $config_php_data) !== false;
+ if (!$config_created)
+ {
+ self::markTestSkipped("Could not write $config_file file.");
+ }
- $crawler = self::submit($form);
+ // We also have to create a install lock that is normally created by
+ // the installer. The file will be removed by the final step of the
+ // installer.
+ $install_lock_file = $phpbb_root_path . 'cache/install_lock';
+ $lock_created = file_put_contents($install_lock_file, '') !== false;
+ if (!$lock_created)
+ {
+ self::markTestSkipped("Could not create $lock_created file.");
+ }
+ @chmod($install_lock_file, 0666);
+
+ // install/index.php?mode=install&sub=advanced
+ $form_data = $form->getValues();
+ unset($form_data['submit']);
+
+ $crawler = self::request('POST', 'install/index.php?mode=install&sub=advanced', $form_data);
self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form(array(
'email_enable' => true,
@@ -308,14 +338,17 @@ class phpbb_functional_test_case extends phpbb_test_case
'script_path' => $parseURL['path'],
));
+ // install/index.php?mode=install&sub=create_table
$crawler = self::submit($form);
self::assertContains('The database tables used by phpBB', $crawler->filter('#main')->text());
self::assertContains('have been created and populated with some initial data.', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form();
+ // install/index.php?mode=install&sub=final
$crawler = self::submit($form);
self::assertContains('You have successfully installed', $crawler->text());
- copy($phpbb_root_path . "config.$phpEx", $phpbb_root_path . "config_test.$phpEx");
+
+ copy($config_file, $config_file_test);
}
static private function recreate_database($config)
@@ -325,6 +358,109 @@ class phpbb_functional_test_case extends phpbb_test_case
}
/**
+ * Creates a new style
+ *
+ * @param string $style_id Style ID
+ * @param string $style_path Style directory
+ * @param string $parent_style_id Parent style id. Default = 1
+ * @param string $parent_style_path Parent style directory. Default = 'prosilver'
+ */
+ protected function add_style($style_id, $style_path, $parent_style_id = 1, $parent_style_path = 'prosilver')
+ {
+ global $phpbb_root_path;
+
+ $db = $this->get_db();
+ if (version_compare(PHPBB_VERSION, '3.1.0-dev', '<'))
+ {
+ $sql = 'INSERT INTO ' . STYLES_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ 'style_id' => $style_id,
+ 'style_name' => $style_path,
+ 'style_copyright' => '',
+ 'style_active' => 1,
+ 'template_id' => $style_id,
+ 'theme_id' => $style_id,
+ 'imageset_id' => $style_id,
+ ));
+ $db->sql_query($sql);
+
+ $sql = 'INSERT INTO ' . STYLES_IMAGESET_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ 'imageset_id' => $style_id,
+ 'imageset_name' => $style_path,
+ 'imageset_copyright' => '',
+ 'imageset_path' => $style_path,
+ ));
+ $db->sql_query($sql);
+
+ $sql = 'INSERT INTO ' . STYLES_TEMPLATE_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ 'template_id' => $style_id,
+ 'template_name' => $style_path,
+ 'template_copyright' => '',
+ 'template_path' => $style_path,
+ 'bbcode_bitfield' => 'kNg=',
+ 'template_inherits_id' => $parent_style_id,
+ 'template_inherit_path' => $parent_style_path,
+ ));
+ $db->sql_query($sql);
+
+ $sql = 'INSERT INTO ' . STYLES_THEME_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ 'theme_id' => $style_id,
+ 'theme_name' => $style_path,
+ 'theme_copyright' => '',
+ 'theme_path' => $style_path,
+ 'theme_storedb' => 0,
+ 'theme_mtime' => 0,
+ 'theme_data' => '',
+ ));
+ $db->sql_query($sql);
+
+ if ($style_path != 'prosilver' && $style_path != 'subsilver2')
+ {
+ @mkdir($phpbb_root_path . 'styles/' . $style_path, 0777);
+ @mkdir($phpbb_root_path . 'styles/' . $style_path . '/template', 0777);
+ }
+ }
+ else
+ {
+ $db->sql_multi_insert(STYLES_TABLE, array(
+ 'style_id' => $style_id,
+ 'style_name' => $style_path,
+ 'style_copyright' => '',
+ 'style_active' => 1,
+ 'style_path' => $style_path,
+ 'bbcode_bitfield' => 'kNg=',
+ 'style_parent_id' => $parent_style_id,
+ 'style_parent_tree' => $parent_style_path,
+ ));
+ }
+ }
+
+ /**
+ * Remove temporary style created by add_style()
+ *
+ * @param string $style_id Style ID
+ * @param string $style_path Style directory
+ */
+ protected function delete_style($style_id, $style_path)
+ {
+ global $phpbb_root_path;
+
+ $db = $this->get_db();
+ $db->sql_query('DELETE FROM ' . STYLES_TABLE . ' WHERE style_id = ' . $style_id);
+ if (version_compare(PHPBB_VERSION, '3.1.0-dev', '<'))
+ {
+ $db->sql_query('DELETE FROM ' . STYLES_IMAGESET_TABLE . ' WHERE imageset_id = ' . $style_id);
+ $db->sql_query('DELETE FROM ' . STYLES_TEMPLATE_TABLE . ' WHERE template_id = ' . $style_id);
+ $db->sql_query('DELETE FROM ' . STYLES_THEME_TABLE . ' WHERE theme_id = ' . $style_id);
+
+ if ($style_path != 'prosilver' && $style_path != 'subsilver2')
+ {
+ @rmdir($phpbb_root_path . 'styles/' . $style_path . '/template');
+ @rmdir($phpbb_root_path . 'styles/' . $style_path);
+ }
+ }
+ }
+
+ /**
* Creates a new user with limited permissions
*
* @param string $username Also doubles up as the user's password
@@ -474,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();
@@ -493,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);
}
@@ -523,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();
@@ -607,6 +743,7 @@ 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.');
}
@@ -703,4 +840,135 @@ class phpbb_functional_test_case extends phpbb_test_case
return $result;
}
+
+ /**
+ * Creates a topic
+ *
+ * Be sure to login before creating
+ *
+ * @param int $forum_id
+ * @param string $subject
+ * @param string $message
+ * @param array $additional_form_data Any additional form data to be sent in the request
+ * @return array post_id, topic_id
+ */
+ public function create_topic($forum_id, $subject, $message, $additional_form_data = array())
+ {
+ $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}";
+
+ $form_data = array_merge(array(
+ 'subject' => $subject,
+ 'message' => $message,
+ 'post' => true,
+ ), $additional_form_data);
+
+ return self::submit_post($posting_url, 'POST_TOPIC', $form_data);
+ }
+
+ /**
+ * Creates a post
+ *
+ * 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
+ * @return array post_id, topic_id
+ */
+ public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array())
+ {
+ $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}";
+
+ $form_data = array_merge(array(
+ 'subject' => $subject,
+ 'message' => $message,
+ 'post' => true,
+ ), $additional_form_data);
+
+ return self::submit_post($posting_url, 'POST_REPLY', $form_data);
+ }
+
+ /**
+ * Helper for submitting posts
+ *
+ * @param string $posting_url
+ * @param string $posting_contains
+ * @param array $form_data
+ * @return array post_id, topic_id
+ */
+ protected function submit_post($posting_url, $posting_contains, $form_data)
+ {
+ $this->add_lang('posting');
+
+ $crawler = self::request('GET', $posting_url);
+ $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text());
+
+ $hidden_fields = array(
+ $crawler->filter('[type="hidden"]')->each(function ($node, $i) {
+ return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value'));
+ }),
+ );
+
+ foreach ($hidden_fields as $fields)
+ {
+ foreach($fields as $field)
+ {
+ $form_data[$field['name']] = $field['value'];
+ }
+ }
+
+ // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened)
+ // is not at least 2 seconds before submission, cancel the form
+ $form_data['lastclick'] = 0;
+
+ // I use a request because the form submission method does not allow you to send data that is not
+ // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs)
+ // Instead, I send it as a request with the submit button "post" set to true.
+ $crawler = self::request('POST', $posting_url, $form_data);
+ $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text());
+ $url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri();
+
+ return array(
+ '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_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..9f281b4c21 100644
--- a/travis/phpunit-postgres-travis.xml
+++ b/travis/phpunit-postgres-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>