diff options
-rw-r--r-- | build/build.xml | 4 | ||||
-rwxr-xr-x | build/package.php | 2 | ||||
-rw-r--r-- | phpBB/adm/index.php | 2 | ||||
-rw-r--r-- | phpBB/adm/style/ajax.js | 6 | ||||
-rw-r--r-- | phpBB/adm/style/install_update.html | 55 | ||||
-rw-r--r-- | phpBB/adm/swatch.php | 2 | ||||
-rw-r--r-- | phpBB/common.php | 7 | ||||
-rw-r--r-- | phpBB/config/services.yml | 36 | ||||
-rw-r--r-- | phpBB/develop/blank.gif | 0 | ||||
-rw-r--r-- | phpBB/develop/blank.jpg | 0 | ||||
-rw-r--r-- | phpBB/develop/mysql_upgrader.php | 22 | ||||
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 5 | ||||
-rw-r--r-- | phpBB/docs/coding-guidelines.html | 20 | ||||
-rw-r--r-- | phpBB/docs/events.md | 92 | ||||
-rw-r--r-- | phpBB/download/file.php | 4 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_database.php | 4 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_modules.php | 1 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permission_roles.php | 19 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permissions.php | 15 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_search.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/auth.php | 37 | ||||
-rw-r--r-- | phpBB/includes/bbcode.php | 5 | ||||
-rw-r--r-- | phpBB/includes/captcha/captcha_factory.php | 3 | ||||
-rw-r--r-- | phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php | 12 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_container.php | 41 | ||||
-rw-r--r-- | phpBB/includes/functions_content.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_install.php | 6 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 33 | ||||
-rw-r--r-- | phpBB/includes/functions_module.php | 6 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 19 | ||||
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 13 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_pm_reports.php | 12 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_post.php | 13 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 13 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_reports.php | 2 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 13 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_warn.php | 15 | ||||
-rw-r--r-- | phpBB/includes/style/extension_path_provider.php | 137 | ||||
-rw-r--r-- | phpBB/includes/style/path_provider.php | 62 | ||||
-rw-r--r-- | phpBB/includes/style/path_provider_interface.php | 42 | ||||
-rw-r--r-- | phpBB/includes/style/resource_locator.php | 348 | ||||
-rw-r--r-- | phpBB/includes/style/style.php | 241 | ||||
-rw-r--r-- | phpBB/includes/template/locator.php | 163 | ||||
-rw-r--r-- | phpBB/includes/template/twig/twig.php | 465 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewmessage.php | 30 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_prefs.php | 2 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 3 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 6 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_remind.php | 2 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 39 | ||||
-rw-r--r-- | phpBB/install/index.php | 73 | ||||
-rw-r--r-- | phpBB/install/install_install.php | 6 | ||||
-rw-r--r-- | phpBB/install/install_update.php | 102 | ||||
-rw-r--r-- | phpBB/install/schemas/schema_data.sql | 2 | ||||
-rw-r--r-- | phpBB/language/en/acp/permissions_phpbb.php | 336 | ||||
-rw-r--r-- | phpBB/language/en/email/installed.txt | 2 | ||||
-rw-r--r-- | phpBB/language/en/help_faq.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/install.php | 8 | ||||
-rw-r--r-- | phpBB/memberlist.php | 13 | ||||
-rw-r--r-- | phpBB/phpbb/auth/auth.php (renamed from phpBB/includes/auth/auth.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/auth/index.htm (renamed from phpBB/includes/auth/index.htm) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/apache.php (renamed from phpBB/includes/auth/provider/apache.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/base.php (renamed from phpBB/includes/auth/provider/base.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/db.php (renamed from phpBB/includes/auth/provider/db.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/index.htm (renamed from phpBB/includes/auth/provider/index.htm) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/interface.php (renamed from phpBB/includes/auth/provider/interface.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/ldap.php (renamed from phpBB/includes/auth/provider/ldap.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/avatar/driver/driver.php (renamed from phpBB/includes/avatar/driver/driver.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/avatar/driver/gravatar.php (renamed from phpBB/includes/avatar/driver/gravatar.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/avatar/driver/interface.php (renamed from phpBB/includes/avatar/driver/interface.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/avatar/driver/local.php (renamed from phpBB/includes/avatar/driver/local.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/avatar/driver/remote.php (renamed from phpBB/includes/avatar/driver/remote.php) | 2 | ||||
-rw-r--r-- | phpBB/phpbb/avatar/driver/upload.php (renamed from phpBB/includes/avatar/driver/upload.php) | 0 | ||||
-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) | 70 | ||||
-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.php (renamed from phpBB/includes/content_visibility.php) | 5 | ||||
-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) | 16 | ||||
-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) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/firebird.php (renamed from phpBB/includes/db/driver/firebird.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/mssql.php (renamed from phpBB/includes/db/driver/mssql.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/mssql_base.php (renamed from phpBB/includes/db/driver/mssql_base.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/mssql_odbc.php (renamed from phpBB/includes/db/driver/mssql_odbc.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/mssqlnative.php (renamed from phpBB/includes/db/driver/mssqlnative.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/mysql.php (renamed from phpBB/includes/db/driver/mysql.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/mysql_base.php (renamed from phpBB/includes/db/driver/mysql_base.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/mysqli.php (renamed from phpBB/includes/db/driver/mysqli.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/oracle.php (renamed from phpBB/includes/db/driver/oracle.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/postgres.php (renamed from phpBB/includes/db/driver/postgres.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/driver/sqlite.php (renamed from phpBB/includes/db/driver/sqlite.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/30x/3_0_1.php (renamed from phpBB/includes/db/migration/data/30x/3_0_1.php) | 2 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-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) | 6 | ||||
-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) | 4 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 2 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-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) | 2 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 2 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-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) | 4 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php (renamed from phpBB/includes/db/migration/data/30x/local_url_bbcode.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/avatars.php (renamed from phpBB/includes/db/migration/data/310/avatars.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/boardindex.php (renamed from phpBB/includes/db/migration/data/310/boardindex.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/config_db_text.php (renamed from phpBB/includes/db/migration/data/310/config_db_text.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/dev.php (renamed from phpBB/includes/db/migration/data/310/dev.php) | 5 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/extensions.php (renamed from phpBB/includes/db/migration/data/310/extensions.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/forgot_password.php (renamed from phpBB/includes/db/migration/data/310/forgot_password.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/jquery_update.php (renamed from phpBB/includes/db/migration/data/310/jquery_update.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php (renamed from phpBB/includes/db/migration/data/310/notification_options_reconvert.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/notifications.php (renamed from phpBB/includes/db/migration/data/310/notifications.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php (renamed from phpBB/includes/db/migration/data/310/notifications_schema_fix.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/reported_posts_display.php (renamed from phpBB/includes/db/migration/data/310/reported_posts_display.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/signature_module_auth.php (renamed from phpBB/includes/db/migration/data/310/signature_module_auth.php) | 2 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php | 55 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/softdelete_p1.php (renamed from phpBB/includes/db/migration/data/310/softdelete_p1.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/softdelete_p2.php (renamed from phpBB/includes/db/migration/data/310/softdelete_p2.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/style_update_p1.php (renamed from phpBB/includes/db/migration/data/310/style_update_p1.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/style_update_p2.php (renamed from phpBB/includes/db/migration/data/310/style_update_p2.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/teampage.php (renamed from phpBB/includes/db/migration/data/310/teampage.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/timezone.php (renamed from phpBB/includes/db/migration/data/310/timezone.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/data/310/timezone_p2.php (renamed from phpBB/includes/db/migration/data/310/timezone_p2.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/exception.php (renamed from phpBB/includes/db/migration/exception.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/migration.php (renamed from phpBB/includes/db/migration/migration.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/tool/config.php (renamed from phpBB/includes/db/migration/tool/config.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/tool/interface.php (renamed from phpBB/includes/db/migration/tool/interface.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/tool/module.php (renamed from phpBB/includes/db/migration/tool/module.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migration/tool/permission.php (renamed from phpBB/includes/db/migration/tool/permission.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/migrator.php (renamed from phpBB/includes/db/migrator.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/sql_insert_buffer.php (renamed from phpBB/includes/db/sql_insert_buffer.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/db/tools.php (renamed from phpBB/includes/db/db_tools.php) | 2 | ||||
-rw-r--r-- | phpBB/phpbb/di/extension/config.php (renamed from phpBB/includes/di/extension/config.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/di/extension/core.php (renamed from phpBB/includes/di/extension/core.php) | 12 | ||||
-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) | 1 | ||||
-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) | 0 | ||||
-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) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/feed/forums.php (renamed from phpBB/includes/feed/forums.php) | 0 | ||||
-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) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/feed/overall.php (renamed from phpBB/includes/feed/overall.php) | 2 | ||||
-rw-r--r-- | phpBB/phpbb/feed/post_base.php (renamed from phpBB/includes/feed/post_base.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/feed/topic.php (renamed from phpBB/includes/feed/topic.php) | 4 | ||||
-rw-r--r-- | phpBB/phpbb/feed/topic_base.php (renamed from phpBB/includes/feed/topic_base.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/feed/topics.php (renamed from phpBB/includes/feed/topics.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/feed/topics_active.php (renamed from phpBB/includes/feed/topics_active.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/filesystem.php (renamed from phpBB/includes/filesystem.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/groupposition/exception.php (renamed from phpBB/includes/groupposition/exception.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/groupposition/interface.php (renamed from phpBB/includes/groupposition/interface.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/groupposition/legend.php (renamed from phpBB/includes/groupposition/legend.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/groupposition/teampage.php (renamed from phpBB/includes/groupposition/teampage.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/hook/finder.php (renamed from phpBB/includes/hook/finder.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/json_response.php (renamed from phpBB/includes/json_response.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/lock/db.php (renamed from phpBB/includes/lock/db.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/lock/flock.php (renamed from phpBB/includes/lock/flock.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/log/interface.php (renamed from phpBB/includes/log/interface.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/log/log.php (renamed from phpBB/includes/log/log.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/exception.php (renamed from phpBB/includes/notification/exception.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/manager.php (renamed from phpBB/includes/notification/manager.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/method/base.php (renamed from phpBB/includes/notification/method/base.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/method/email.php (renamed from phpBB/includes/notification/method/email.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/method/interface.php (renamed from phpBB/includes/notification/method/interface.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/method/jabber.php (renamed from phpBB/includes/notification/method/jabber.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/method/messenger_base.php (renamed from phpBB/includes/notification/method/messenger_base.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/approve_post.php (renamed from phpBB/includes/notification/type/approve_post.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/approve_topic.php (renamed from phpBB/includes/notification/type/approve_topic.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/base.php (renamed from phpBB/includes/notification/type/base.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/bookmark.php (renamed from phpBB/includes/notification/type/bookmark.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/disapprove_post.php (renamed from phpBB/includes/notification/type/disapprove_post.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/disapprove_topic.php (renamed from phpBB/includes/notification/type/disapprove_topic.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/interface.php (renamed from phpBB/includes/notification/type/interface.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/pm.php (renamed from phpBB/includes/notification/type/pm.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/post.php (renamed from phpBB/includes/notification/type/post.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/post_in_queue.php (renamed from phpBB/includes/notification/type/post_in_queue.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/quote.php (renamed from phpBB/includes/notification/type/quote.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_pm.php (renamed from phpBB/includes/notification/type/report_pm.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_pm_closed.php (renamed from phpBB/includes/notification/type/report_pm_closed.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_post.php (renamed from phpBB/includes/notification/type/report_post.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_post_closed.php (renamed from phpBB/includes/notification/type/report_post_closed.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/topic.php (renamed from phpBB/includes/notification/type/topic.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/topic_in_queue.php (renamed from phpBB/includes/notification/type/topic_in_queue.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/permissions.php | 340 | ||||
-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) | 2 | ||||
-rw-r--r-- | phpBB/phpbb/search/fulltext_native.php (renamed from phpBB/includes/search/fulltext_native.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/search/fulltext_postgres.php (renamed from phpBB/includes/search/fulltext_postgres.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/search/fulltext_sphinx.php (renamed from phpBB/includes/search/fulltext_sphinx.php) | 5 | ||||
-rw-r--r-- | phpBB/phpbb/search/index.htm (renamed from phpBB/includes/search/index.htm) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/search/sphinx/config.php (renamed from phpBB/includes/search/sphinx/config.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/search/sphinx/config_comment.php (renamed from phpBB/includes/search/sphinx/config_comment.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/search/sphinx/config_section.php (renamed from phpBB/includes/search/sphinx/config_section.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/search/sphinx/config_variable.php (renamed from phpBB/includes/search/sphinx/config_variable.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/session.php (renamed from phpBB/includes/session.php) | 3 | ||||
-rw-r--r-- | phpBB/phpbb/template/asset.php (renamed from phpBB/includes/template/asset.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/base.php | 148 | ||||
-rw-r--r-- | phpBB/phpbb/template/context.php (renamed from phpBB/includes/template/context.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/template.php (renamed from phpBB/includes/template/template.php) | 28 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/definition.php (renamed from phpBB/includes/template/twig/definition.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/environment.php (renamed from phpBB/includes/template/twig/environment.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/extension.php (renamed from phpBB/includes/template/twig/extension.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/lexer.php (renamed from phpBB/includes/template/twig/lexer.php) | 45 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/define.php (renamed from phpBB/includes/template/twig/node/define.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/event.php (renamed from phpBB/includes/template/twig/node/event.php) | 8 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/expression/binary/equalequal.php (renamed from phpBB/includes/template/twig/node/expression/binary/equalequal.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php (renamed from phpBB/includes/template/twig/node/expression/binary/notequalequal.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/include.php (renamed from phpBB/includes/template/twig/node/include.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/includeasset.php (renamed from phpBB/includes/template/twig/node/includeasset.php) | 17 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/includecss.php (renamed from phpBB/includes/template/twig/node/includecss.php) | 9 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/includejs.php (renamed from phpBB/includes/template/twig/node/includejs.php) | 9 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/includephp.php (renamed from phpBB/includes/template/twig/node/includephp.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/php.php (renamed from phpBB/includes/template/twig/node/php.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/tokenparser/define.php (renamed from phpBB/includes/template/twig/tokenparser/define.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/tokenparser/event.php (renamed from phpBB/includes/template/twig/tokenparser/event.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/tokenparser/include.php (renamed from phpBB/includes/template/twig/tokenparser/include.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/tokenparser/includecss.php (renamed from phpBB/includes/template/twig/tokenparser/includecss.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/tokenparser/includejs.php (renamed from phpBB/includes/template/twig/tokenparser/includejs.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/tokenparser/includephp.php (renamed from phpBB/includes/template/twig/tokenparser/includephp.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/tokenparser/php.php (renamed from phpBB/includes/template/twig/tokenparser/php.php) | 0 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/twig.php | 328 | ||||
-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) | 28 | ||||
-rw-r--r-- | phpBB/phpbb/user_loader.php (renamed from phpBB/includes/user_loader.php) | 0 | ||||
-rw-r--r-- | phpBB/report.php | 18 | ||||
-rw-r--r-- | phpBB/search.php | 33 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/bbcode.html | 4 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/editor.js | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/mcp_forum.html | 15 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/mcp_front.html | 4 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/mcp_warn_list.html | 15 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/memberlist_body.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/memberlist_search.html | 1 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/memberlist_view.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/overall_header.html | 3 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/posting_poll_body.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/posting_smilies.html | 4 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/search_results.html | 17 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/simple_footer.html | 6 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/simple_header.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/ucp_pm_viewfolder.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/ucp_pm_viewmessage.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/viewforum_body.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/viewtopic_body.html | 16 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/bidi.css | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/colours.css | 16 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/common.css | 4 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/content.css | 8 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/en/button_pm_forward.gif | bin | 2168 -> 0 bytes | |||
-rw-r--r-- | phpBB/styles/prosilver/theme/en/button_pm_new.gif | bin | 2005 -> 0 bytes | |||
-rw-r--r-- | phpBB/styles/prosilver/theme/en/button_pm_reply.gif | bin | 2126 -> 0 bytes | |||
-rw-r--r-- | phpBB/styles/prosilver/theme/en/button_topic_locked.gif | bin | 1923 -> 0 bytes | |||
-rw-r--r-- | phpBB/styles/prosilver/theme/en/button_topic_new.gif | bin | 2737 -> 0 bytes | |||
-rw-r--r-- | phpBB/styles/prosilver/theme/en/button_topic_reply.gif | bin | 2135 -> 0 bytes | |||
-rw-r--r-- | phpBB/styles/prosilver/theme/en/stylesheet.css | 30 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/imageset.css | 30 | ||||
-rw-r--r-- | phpBB/styles/prosilver/theme/print.css | 2 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/bbcode.html | 4 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/memberlist_body.html | 2 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/memberlist_view.html | 4 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/overall_header.html | 6 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/posting_smilies.html | 4 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/search_results.html | 2 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/simple_footer.html | 3 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/ucp_header.html | 4 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/ucp_pm_history.html | 2 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/ucp_profile_signature.html | 43 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/viewforum_body.html | 4 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/viewtopic_body.html | 18 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/theme/stylesheet.css | 10 | ||||
-rw-r--r-- | phpBB/viewforum.php | 23 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 55 | ||||
-rw-r--r-- | phpunit.xml.all | 5 | ||||
-rw-r--r-- | phpunit.xml.dist | 5 | ||||
-rw-r--r-- | phpunit.xml.functional | 5 | ||||
-rw-r--r-- | tests/bootstrap.php | 4 | ||||
-rw-r--r-- | tests/class_loader/class_loader_test.php | 10 | ||||
-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/controller/controller_test.php | 2 | ||||
-rw-r--r-- | tests/controller/helper_url_test.php | 4 | ||||
-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.php | 3 | ||||
-rw-r--r-- | tests/dbal/auto_increment_test.php | 1 | ||||
-rw-r--r-- | tests/dbal/db_tools_test.php | 1 | ||||
-rw-r--r-- | tests/dbal/migrator_test.php | 4 | ||||
-rw-r--r-- | tests/dbal/migrator_tool_config_test.php | 3 | ||||
-rw-r--r-- | tests/dbal/migrator_tool_module_test.php | 2 | ||||
-rw-r--r-- | tests/dbal/migrator_tool_permission_test.php | 2 | ||||
-rw-r--r-- | tests/di/create_container_test.php | 6 | ||||
-rw-r--r-- | tests/error_collector_test.php | 1 | ||||
-rw-r--r-- | tests/extension/finder_test.php | 8 | ||||
-rw-r--r-- | tests/extension/metadata_manager_test.php | 2 | ||||
-rw-r--r-- | tests/extension/phpbb/default/implementation.php (renamed from tests/extension/includes/default/implementation.php) | 0 | ||||
-rw-r--r-- | tests/extension/style_path_provider_test.php | 50 | ||||
-rw-r--r-- | tests/extension/subdir/style_path_provider_test.php | 18 | ||||
-rw-r--r-- | tests/functional/avatar_acp_groups_test.php | 63 | ||||
-rw-r--r-- | tests/functional/avatar_acp_users_test.php | 61 | ||||
-rw-r--r-- | tests/functional/avatar_ucp_groups_test.php | 71 | ||||
-rw-r--r-- | tests/functional/avatar_ucp_users_test.php | 78 | ||||
-rw-r--r-- | tests/functional/browse_test.php | 7 | ||||
-rw-r--r-- | tests/functional/common_avatar_test.php | 80 | ||||
-rw-r--r-- | tests/functional/extension_controller_test.php | 1 | ||||
-rw-r--r-- | tests/functional/extension_global_lang_test.php | 63 | ||||
-rw-r--r-- | tests/functional/extension_module_test.php | 2 | ||||
-rw-r--r-- | tests/functional/extension_permission_lang_test.php | 3 | ||||
-rw-r--r-- | tests/functional/fileupload_remote_test.php | 6 | ||||
-rw-r--r-- | tests/functional/fixtures/ext/foo/bar/event/permission.php | 40 | ||||
-rw-r--r-- | tests/functional/fixtures/ext/foo/bar/event/user_setup.php | 43 | ||||
-rw-r--r-- | tests/functional/fixtures/ext/foo/bar/language/en/foo_global.php | 5 | ||||
-rw-r--r-- | tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php | 3 | ||||
-rw-r--r-- | tests/functional/mcp_test.php | 67 | ||||
-rw-r--r-- | tests/functional/metadata_manager_test.php | 2 | ||||
-rw-r--r-- | tests/functional/report_post_captcha_test.php (renamed from tests/functional/report_post_captcha.php) | 19 | ||||
-rw-r--r-- | tests/log/function_view_log_test.php | 1 | ||||
-rw-r--r-- | tests/mock/auth_provider.php | 53 | ||||
-rw-r--r-- | tests/mock/session_testable.php | 4 | ||||
-rw-r--r-- | tests/notification/convert_test.php | 2 | ||||
-rw-r--r-- | tests/session/check_ban_test.php | 78 | ||||
-rw-r--r-- | tests/session/check_isvalid_test.php | 61 | ||||
-rw-r--r-- | tests/session/continue_test.php | 133 | ||||
-rw-r--r-- | tests/session/create_test.php | 43 | ||||
-rw-r--r-- | tests/session/creation_test.php | 69 | ||||
-rw-r--r-- | tests/session/extract_hostname_test.php | 51 | ||||
-rw-r--r-- | tests/session/extract_page_test.php | 115 | ||||
-rw-r--r-- | tests/session/fixtures/sessions_banlist.xml | 66 | ||||
-rw-r--r-- | tests/session/fixtures/sessions_full.xml | 3 | ||||
-rw-r--r-- | tests/session/fixtures/sessions_garbage.xml | 58 | ||||
-rw-r--r-- | tests/session/fixtures/sessions_key.xml | 44 | ||||
-rw-r--r-- | tests/session/garbage_collection_test.php | 53 | ||||
-rw-r--r-- | tests/session/session_key_test.php | 51 | ||||
-rw-r--r-- | tests/session/testable_facade.php | 142 | ||||
-rw-r--r-- | tests/session/testable_factory.php | 40 | ||||
-rw-r--r-- | tests/session/unset_admin_test.php | 48 | ||||
-rw-r--r-- | tests/session/validate_referrer_test.php | 70 | ||||
-rw-r--r-- | tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test.html (renamed from tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/test.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test.html (renamed from tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/test.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test.html (renamed from tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/test.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test.html (renamed from tests/template/datasets/event_inheritance/ext/omega/styles/all/template/test.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test.html (renamed from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/test.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two.html (renamed from tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/two.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test.html (renamed from tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/test.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing.html (renamed from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event_variable_spacing.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop.html | 1 | ||||
-rw-r--r-- | tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal.html (renamed from tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/universal.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple.html (renamed from tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/simple.html) | 0 | ||||
-rw-r--r-- | tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html | 3 | ||||
-rw-r--r-- | tests/template/includephp_test.php | 2 | ||||
-rw-r--r-- | tests/template/template_events_test.php | 15 | ||||
-rw-r--r-- | tests/template/template_test.php | 43 | ||||
-rw-r--r-- | tests/template/template_test_case.php | 8 | ||||
-rw-r--r-- | tests/template/template_test_case_with_tree.php | 5 | ||||
-rw-r--r-- | tests/template/templates/define.html | 7 | ||||
-rw-r--r-- | tests/template/templates/if.html | 2 | ||||
-rw-r--r-- | tests/template/templates/include_loop.html | 8 | ||||
-rw-r--r-- | tests/template/templates/include_loop_define.html | 6 | ||||
-rw-r--r-- | tests/template/templates/loop.html | 14 | ||||
-rw-r--r-- | tests/template/templates/loop_advanced.html | 20 | ||||
-rw-r--r-- | tests/template/templates/loop_size.html | 10 | ||||
-rw-r--r-- | tests/template/templates/loop_vars.html | 18 | ||||
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 23 | ||||
-rw-r--r-- | tests/test_framework/phpbb_session_test_case.php | 36 | ||||
-rw-r--r-- | tests/text_processing/generate_text_for_display_test.php | 38 | ||||
-rw-r--r-- | tests/upload/fileupload_test.php | 1 | ||||
-rw-r--r-- | travis/phpunit-postgres-travis.xml | 3 |
448 files changed, 3693 insertions, 2841 deletions
diff --git a/build/build.xml b/build/build.xml index 5b4cf8b496..f8181160c1 100644 --- a/build/build.xml +++ b/build/build.xml @@ -170,8 +170,8 @@ checkreturn="true" /> <!-- Install composer dependencies, if there are any. --> - <exec dir="." - command='php -r "\$j = json_decode(file_get_contents("composer.json")); echo isset(\$j->require);"' + <exec dir="${dir}" + command='php -r "\$j = json_decode(file_get_contents(\"composer.json\")); echo isset(\$j->require);"' checkreturn="true" outputProperty='composer-has-dependencies' /> <if> diff --git a/build/package.php b/build/package.php index 48f42b3572..eef6765af6 100755 --- a/build/package.php +++ b/build/package.php @@ -121,6 +121,7 @@ if (sizeof($package->old_packages)) $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $dest_filename_dir); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $dest_filename_dir); + $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $dest_filename_dir); $package->run_command('mkdir ' . $dest_filename_dir . '/install/update'); $package->run_command('mkdir ' . $dest_filename_dir . '/install/update/old'); @@ -256,6 +257,7 @@ $update_info = array( // Copy the install files to their respective locations $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('patch_directory')); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('patch_directory')); + $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/vendor ' . $package->get('patch_directory')); // Remove some files chdir($package->get('patch_directory') . '/install'); diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 8cd1967c75..3520eb8b70 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -50,7 +50,7 @@ $module_id = request_var('i', ''); $mode = request_var('mode', ''); // Set custom style for admin area -$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style'); $template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 6f21dfa6ac..efb0639f1b 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -127,8 +127,10 @@ phpbb.addAjaxCallback('activate_deactivate', function(res) { * The removes the parent row of the link or form that triggered the callback, * and is good for stuff like the removal of forums. */ -phpbb.addAjaxCallback('row_delete', function() { - $(this).parents('tr').remove(); +phpbb.addAjaxCallback('row_delete', function(res) { + if (res.SUCCESS !== false) { + $(this).parents('tr').remove(); + } }); diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index b5fa46dbf6..57e2c8ffea 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -109,27 +109,14 @@ <!-- ENDIF --> </fieldset> - <!-- IF not S_UP_TO_DATE --> - - <form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}"> - - <fieldset class="submit-buttons"> - <p>{L_UPDATE_DATABASE_EXPLAIN}</p> - <input class="button1" type="submit" name="db_update" value="{L_UPDATE_DATABASE}" /> - </fieldset> - - </form> - - <!-- ELSE --> - <form id="install_update" method="post" action="{U_ACTION}"> + <form id="install_update" method="post" action="{U_ACTION}"> - <fieldset class="submit-buttons"> - <p>{L_CHECK_FILES_UP_TO_DATE}</p> - <input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" /> - </fieldset> + <fieldset class="submit-buttons"> + <p>{L_CHECK_FILES_EXPLAIN}</p> + <input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" /> + </fieldset> - </form> - <!-- ENDIF --> + </form> <!-- ELSEIF S_DB_UPDATE --> @@ -155,29 +142,29 @@ <!-- ELSE --> - <h1>{L_UPDATE_DB_SUCCESS}</h1> + <div class="successbox"> + <h3>{L_UPDATE_SUCCESS}</h3> + <p>{L_EVERYTHING_UP_TO_DATE}</p> + </div> - <br /><br /> + <!-- ENDIF --> - <form id="install_update" method="post" action="{U_ACTION}"> +<!-- ELSEIF S_FILE_CHECK --> - <fieldset class="submit-buttons"> - <p>{L_CHECK_FILES_EXPLAIN}</p> - <input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" /> - </fieldset> + <!-- IF S_ALL_UP_TO_DATE --> - </form> + <h1>{L_UPDATE_FILE_SUCCESS}</h1> + <p>{L_ALL_FILES_UP_TO_DATE}</p> - <!-- ENDIF --> + <p>{L_UPDATE_DATABASE_EXPLAIN}</p> -<!-- ELSEIF S_FILE_CHECK --> + <form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}"> - <!-- IF S_ALL_UP_TO_DATE --> + <fieldset class="submit-buttons"> + <input class="button1" type="submit" name="db_update" value="{L_UPDATE_DATABASE}" /> + </fieldset> - <div class="successbox"> - <h3>{L_UPDATE_SUCCESS}</h3> - <p>{L_ALL_FILES_UP_TO_DATE}</p> - </div> + </form> <!-- ELSE --> <h1>{L_COLLECTED_INFORMATION}</h1> diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php index 3ae38d0d8b..cdd6bf3969 100644 --- a/phpBB/adm/swatch.php +++ b/phpBB/adm/swatch.php @@ -22,7 +22,7 @@ $auth->acl($user->data); $user->setup(); // Set custom template for admin area -$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); +$template->set_custom_style('admin', $phpbb_admin_path . 'style'); $template->set_filenames(array( 'body' => 'colour_swatch.html') diff --git a/phpBB/common.php b/phpBB/common.php index 236d456eec..a7b7db28ac 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(); @@ -124,7 +124,6 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager'); $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader'); $template = $phpbb_container->get('template'); -$phpbb_style = $phpbb_container->get('style'); // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 25fff79de3..d0753322da 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -8,6 +8,12 @@ imports: - { resource: auth_providers.yml } services: + acl.permissions: + class: phpbb_permissions + arguments: + - @dispatcher + - @user + auth: class: phpbb_auth @@ -92,7 +98,7 @@ services: arguments: - @user - @service_container - - @style + - @template cron.task_collection: class: phpbb_di_service_collection @@ -126,7 +132,6 @@ services: - [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]] dbal.tools: - file: %core.root_path%includes/db/db_tools.%core.php_ext% class: phpbb_db_tools arguments: - @dbal.conn @@ -240,33 +245,12 @@ services: - %tables.notifications% - %tables.user_notifications% + php_ini: + class: phpbb_php_ini + request: class: phpbb_request - style: - class: phpbb_style - arguments: - - %core.root_path% - - %core.php_ext% - - @config - - @user - - @style.resource_locator - - @style.path_provider_ext - - @template - - style.resource_locator: - class: phpbb_style_resource_locator - - style.path_provider_ext: - class: phpbb_style_extension_path_provider - arguments: - - @ext.manager - - @style.path_provider - - %core.root_path% - - style.path_provider: - class: phpbb_style_path_provider - template: class: phpbb_template_twig arguments: diff --git a/phpBB/develop/blank.gif b/phpBB/develop/blank.gif new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/phpBB/develop/blank.gif diff --git a/phpBB/develop/blank.jpg b/phpBB/develop/blank.jpg new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/phpBB/develop/blank.jpg diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 597dd5e932..f5e7e97400 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -149,7 +149,8 @@ foreach ($schema_data as $table_name => $table_data) list($orig_column_type, $column_length) = explode(':', $column_data[0]); $column_type = sprintf($dbms_type_map['mysql_41'][$orig_column_type . ':'], $column_length); - if (isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0])) + if (isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit']) && + isset($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0])) { switch ($dbms_type_map['mysql_40'][$orig_column_type . ':']['limit'][0]) { @@ -698,6 +699,24 @@ function get_schema_struct() ), ); + $schema_data['phpbb_login_attempts'] = array( + 'COLUMNS' => array( + 'attempt_ip' => array('VCHAR:40', ''), + 'attempt_browser' => array('VCHAR:150', ''), + 'attempt_forwarded_for' => array('VCHAR:255', ''), + 'attempt_time' => array('TIMESTAMP', 0), + 'user_id' => array('UINT', 0), + 'username' => array('VCHAR_UNI:255', 0), + 'username_clean' => array('VCHAR_CI', 0), + ), + 'KEYS' => array( + 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), + 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), + 'att_time' => array('INDEX', array('attempt_time')), + 'user_id' => array('INDEX', 'user_id'), + ), + ); + $schema_data['phpbb_moderator_cache'] = array( 'COLUMNS' => array( 'forum_id' => array('UINT', 0), @@ -901,6 +920,7 @@ function get_schema_struct() 'field_default_value' => array('VCHAR_UNI', ''), 'field_validation' => array('VCHAR_UNI:20', ''), 'field_required' => array('BOOL', 0), + 'field_show_novalue' => array('BOOL', 0), 'field_show_on_reg' => array('BOOL', 0), 'field_show_on_vt' => array('BOOL', 0), 'field_show_profile' => array('BOOL', 0), diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 97f8c40383..bb42736daf 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -183,6 +183,8 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11662">PHPBB3-11662</a>] - "occured" should be "occurred"</li> <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11670">PHPBB3-11670</a>] - Replace trademark â„¢ with ® on "Welcome to phpBB" 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> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11524">PHPBB3-11524</a>] - MySQL Upgrader throws warnings on PHP 5.4</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11720">PHPBB3-11720</a>] - Reporting posts leads to white page error</li> </ul> <h4>Improvement</h4> <ul> @@ -206,6 +208,7 @@ <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> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11740">PHPBB3-11740</a>] - Update link in FAQ to Ideas Centre</li> </ul> <h4>Sub-task</h4> <ul> @@ -231,6 +234,8 @@ <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> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11752">PHPBB3-11752</a>] - Update phpBB.com URLs to https in email templates</li> +<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11753">PHPBB3-11753</a>] - Upgrade mysql_upgrader.php schema data.</li> </ul> <a name="v3010"></a><h3>1.ii. Changes since 3.0.10</h3> diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 7c588a4905..6cd2627f43 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -832,7 +832,7 @@ $sql = 'SELECT * $sql_ary = array( 'somedata' => $my_string, 'otherdata' => $an_int, - 'moredata' => $another_int + 'moredata' => $another_int, ); $db->sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); @@ -844,7 +844,7 @@ $db->sql_query('INSERT INTO ' . SOME_TABLE . ' ' . $db->sql_build_array('I $sql_ary = array( 'somedata' => $my_string, 'otherdata' => $an_int, - 'moredata' => $another_int + 'moredata' => $another_int, ); $sql = 'UPDATE ' . SOME_TABLE . ' @@ -937,20 +937,20 @@ $sql_array = array( 'FROM' => array( FORUMS_WATCH_TABLE => 'fw', - FORUMS_TABLE => 'f' + FORUMS_TABLE => 'f', ), 'LEFT_JOIN' => array( array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' - ) + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id', + ), ), 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . ' AND f.forum_id = fw.forum_id', - 'ORDER_BY' => 'left_id' + 'ORDER_BY' => 'left_id', ); $sql = $db->sql_build_query('SELECT', $sql_array); @@ -964,13 +964,13 @@ $sql_array = array( 'FROM' => array( FORUMS_WATCH_TABLE => 'fw', - FORUMS_TABLE => 'f' + FORUMS_TABLE => 'f', ), 'WHERE' => 'fw.user_id = ' . $user->data['user_id'] . ' AND f.forum_id = fw.forum_id', - 'ORDER_BY' => 'left_id' + 'ORDER_BY' => 'left_id', ); if ($config['load_db_lastread']) @@ -978,8 +978,8 @@ if ($config['load_db_lastread']) $sql_array['LEFT_JOIN'] = array( array( 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), - 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id' - ) + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id', + ), ); $sql_array['SELECT'] .= ', ft.mark_time '; diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 3723bf7b3f..af6e6bdb1c 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -52,6 +52,36 @@ index_body_stat_blocks_before + styles/subsilver2/template/index_body.html * Purpose: Add new statistic blocks above the Who Is Online and Board Statistics blocks +memberlist_body_username_append +=== +* Locations: + + styles/prosilver/template/memberlist_body.html + + styles/subsilver2/template/memberlist_body.html +* Purpose: Add information after every username in the memberlist. Works in +all display modes (leader, group and normal memberlist). + +memberlist_body_username_prepend +=== +* Locations: + + styles/prosilver/template/memberlist_body.html + + styles/subsilver2/template/memberlist_body.html +* Purpose: Add information before every username in the memberlist. Works in +all display modes (leader, group and normal memberlist). + +memberlist_view_user_statistics_after +=== +* Locations: + + styles/prosilver/template/memberlist_view.html + + styles/subsilver2/template/memberlist_view.html +* Purpose: Add entries after the user statistics part of any user profile + +memberlist_view_user_statistics_before +=== +* Locations: + + styles/prosilver/template/memberlist_view.html + + styles/subsilver2/template/memberlist_view.html +* Purpose: Add entries before the user statistics part of any user profile + overall_footer_after === * Locations: @@ -114,6 +144,36 @@ simple_footer_after * Location: styles/prosilver/template/simple_footer.html * Purpose: Add content directly prior to the `</body>` tag of the simple footer +topiclist_row_prepend +=== +* Locations: + + styles/prosilver/template/search_results.html + + styles/prosilver/template/viewforum_body.html + + styles/subsilver2/template/search_results.html + + styles/subsilver2/template/viewforum_body.html +* Purpose: Add content into topic rows (inside the elements containing topic titles) + +topiclist_row_append +=== +* Locations: + + styles/prosilver/template/search_results.html + + styles/prosilver/template/viewforum_body.html + + styles/subsilver2/template/search_results.html + + styles/subsilver2/template/viewforum_body.html +* Purpose: Add content into topic rows (inside the elements containing topic titles) + +ucp_pm_viewmessage_custom_fields_after +=== +* Location: styles/prosilver/template/ucp_pm_viewmessage.html +* Purpose: Add data after the custom fields on the user profile when viewing +a private message + +ucp_pm_viewmessage_custom_fields_before +=== +* Location: styles/prosilver/template/ucp_pm_viewmessage.html +* Purpose: Add data before the custom fields on the user profile when viewing +a private message + ucp_pm_viewmessage_print_head_append === * Location: styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -133,6 +193,38 @@ viewtopic_body_footer_before and quick reply, directly before the jumpbox in Prosilver, breadcrumbs in Subsilver2. +viewtopic_body_post_buttons_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Purpose: Add post button to posts (next to edit, quote etc), at the end of +the list. + +viewtopic_body_post_buttons_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Purpose: Add post button to posts (next to edit, quote etc), at the start of +the list. + +viewtopic_body_postrow_custom_fields_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Purpose: Add data after the custom fields on the user profile when viewing +a post + +viewtopic_body_postrow_custom_fields_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Purpose: Add data before the custom fields on the user profile when viewing +a post + viewtopic_topic_title_prepend === * Locations: diff --git a/phpBB/download/file.php b/phpBB/download/file.php index cf7128b25b..5a091db7c7 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -41,7 +41,7 @@ if (isset($_GET['avatar'])) exit; } - require($phpbb_root_path . 'includes/class_loader.' . $phpEx); + require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); @@ -50,7 +50,7 @@ if (isset($_GET['avatar'])) require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Setup class loader first - $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); + $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx); $phpbb_class_loader_ext->register(); diff --git a/phpBB/includes/acp/acp_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_modules.php b/phpBB/includes/acp/acp_modules.php index a1e681b29c..7a1d30196d 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -379,6 +379,7 @@ class acp_modules $json_response->send(array( 'MESSAGE_TITLE' => $user->lang('ERROR'), 'MESSAGE_TEXT' => implode('<br />', $errors), + 'SUCCESS' => false, )); } diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index e830479389..17e48d6576 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -25,7 +25,7 @@ class acp_permission_roles function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $phpbb_container; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); @@ -306,6 +306,8 @@ class acp_permission_roles trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } + $phpbb_permissions = $phpbb_container->get('acl.permissions'); + $template->assign_vars(array( 'S_EDIT' => true, @@ -314,9 +316,8 @@ class acp_permission_roles 'ROLE_NAME' => $role_row['role_name'], 'ROLE_DESCRIPTION' => $role_row['role_description'], - 'L_ACL_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)], - ) - ); + 'L_ACL_TYPE' => $phpbb_permissions->get_type_lang($permission_type), + )); // We need to fill the auth options array with ACL_NO options ;) $sql = 'SELECT auth_option_id, auth_option @@ -456,7 +457,9 @@ class acp_permission_roles */ function display_auth_options($auth_options) { - global $template, $user; + global $template, $user, $phpbb_container; + + $phpbb_permissions = $phpbb_container->get('acl.permissions'); $content_array = $categories = array(); $key_sort_array = array(0); @@ -473,7 +476,7 @@ class acp_permission_roles foreach ($content_array as $cat => $cat_array) { $template->assign_block_vars('auth', array( - 'CAT_NAME' => $user->lang['permission_cat'][$cat], + 'CAT_NAME' => $phpbb_permissions->get_category_lang($cat), 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, @@ -488,8 +491,8 @@ class acp_permission_roles 'S_NO' => ($allowed == ACL_NO) ? true : false, 'FIELD_NAME' => $permission, - 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) - ); + 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission), + )); } } } diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index a64765f4f5..ed7159996a 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -22,15 +22,18 @@ class acp_permissions { var $u_action; var $permission_dropdown; + protected $permissions; function main($id, $mode) { - global $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $cache, $phpbb_container; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + $this->permissions = $phpbb_container->get('acl.permissions'); + $auth_admin = new auth_admin(); $user->add_lang('acp/permissions'); @@ -49,7 +52,7 @@ class acp_permissions if ($user_id && isset($auth_admin->acl_options['id'][$permission]) && $auth->acl_get('a_viewauth')) { - $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $user->lang['acl_' . $permission]['lang']); + $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $this->permissions->get_permission_lang($permission)); $this->permission_trace($user_id, $forum_id, $permission); return; } @@ -512,7 +515,7 @@ class acp_permissions $template->assign_vars(array( 'S_PERMISSION_DROPDOWN' => (sizeof($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, - 'L_PERMISSION_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)], + 'L_PERMISSION_TYPE' => $this->permissions->get_type_lang($permission_type), 'U_ACTION' => $this->u_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields) @@ -587,7 +590,7 @@ class acp_permissions */ function build_permission_dropdown($options, $default_option, $permission_scope) { - global $user, $auth; + global $auth; $s_dropdown_options = ''; foreach ($options as $setting) @@ -598,7 +601,7 @@ class acp_permissions } $selected = ($setting == $default_option) ? ' selected="selected"' : ''; - $l_setting = (isset($user->lang['permission_type'][$permission_scope][$setting])) ? $user->lang['permission_type'][$permission_scope][$setting] : $user->lang['permission_type'][$setting]; + $l_setting = $this->permissions->get_type_lang($setting, $permission_scope); $s_dropdown_options .= '<option value="' . $setting . '"' . $selected . '>' . $l_setting . '</option>'; } @@ -979,7 +982,7 @@ class acp_permissions $back = request_var('back', 0); $template->assign_vars(array( - 'PERMISSION' => $user->lang['acl_' . $permission]['lang'], + 'PERMISSION' => $this->permissions->get_permission_lang($permission), 'PERMISSION_USERNAME' => $userdata['username'], 'FORUM_NAME' => $forum_name, diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 6618e2c3f9..11a2511aee 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -560,7 +560,7 @@ class acp_search return $finder ->extension_suffix('_backend') ->extension_directory('/search') - ->core_path('includes/search/') + ->core_path('phpbb/search/') ->get_classes(); } diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 6b1da46a12..4ade9cab13 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -261,7 +261,8 @@ class auth_admin extends phpbb_auth */ function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true) { - global $template, $user, $db, $phpbb_root_path, $phpEx; + global $template, $user, $db, $phpbb_root_path, $phpEx, $phpbb_container; + $phpbb_permissions = $phpbb_container->get('acl.permissions'); // Define names for template loops, might be able to be set $tpl_pmask = 'p_mask'; @@ -269,7 +270,7 @@ class auth_admin extends phpbb_auth $tpl_category = 'category'; $tpl_mask = 'mask'; - $l_acl_type = (isset($user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)])) ? $user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type); + $l_acl_type = $phpbb_permissions->get_type_lang($permission_type, (($local) ? 'local' : 'global')); // Allow trace for viewing permissions and in user mode $show_trace = ($mode == 'view' && $user_mode == 'user') ? true : false; @@ -1100,7 +1101,9 @@ class auth_admin extends phpbb_auth */ function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view) { - global $template, $user, $phpbb_admin_path, $phpEx; + global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container; + + $phpbb_permissions = $phpbb_container->get('acl.permissions'); @reset($category_array); while (list($cat, $cat_array) = each($category_array)) @@ -1110,8 +1113,8 @@ class auth_admin extends phpbb_auth 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, - 'CAT_NAME' => $user->lang['permission_cat'][$cat]) - ); + 'CAT_NAME' => $phpbb_permissions->get_category_lang($cat), + )); /* Sort permissions by name (more naturaly and user friendly than sorting by a primary key) * Commented out due to it's memory consumption and time needed @@ -1145,8 +1148,8 @@ class auth_admin extends phpbb_auth 'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', 'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', - 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) - ); + 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission), + )); } else { @@ -1163,8 +1166,8 @@ class auth_admin extends phpbb_auth 'U_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission") : '', 'UA_TRACE' => ($show_trace) ? append_sid("{$phpbb_admin_path}index.$phpEx", "i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission", false) : '', - 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) - ); + 'PERMISSION' => $phpbb_permissions->get_permission_lang($permission), + )); } } } @@ -1176,7 +1179,9 @@ class auth_admin extends phpbb_auth */ function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array) { - global $user; + global $user, $phpbb_container; + + $phpbb_permissions = $phpbb_container->get('acl.permissions'); foreach ($key_sort_array as $forum_id) { @@ -1191,20 +1196,12 @@ class auth_admin extends phpbb_auth @reset($permissions); while (list($permission, $auth_setting) = each($permissions)) { - if (!isset($user->lang['acl_' . $permission])) - { - $user->lang['acl_' . $permission] = array( - 'cat' => 'misc', - 'lang' => '{ acl_' . $permission . ' }' - ); - } - - $cat = $user->lang['acl_' . $permission]['cat']; + $cat = $phpbb_permissions->get_permission_category($permission); // Build our categories array if (!isset($categories[$cat])) { - $categories[$cat] = $user->lang['permission_cat'][$cat]; + $categories[$cat] = $phpbb_permissions->get_category_lang($cat); } // Build our content array diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index fd00728510..2fa6a8b099 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -132,11 +132,8 @@ class bbcode { $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); - $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_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_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); } diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php index 1ed8e119b5..fac45087e3 100644 --- a/phpBB/includes/captcha/captcha_factory.php +++ b/phpBB/includes/captcha/captcha_factory.php @@ -50,7 +50,8 @@ class phpbb_captcha_factory { include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx); } - call_user_func(array($name, 'garbage_collect'), 0); + $captcha = self::get_instance($name); + $captcha->garbage_collect(0); } /** diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index ec7636f511..6843f25d72 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -110,12 +110,8 @@ class phpbb_captcha_qa */ static public function is_installed() { - global $db, $phpbb_root_path, $phpEx; + global $db; - if (!class_exists('phpbb_db_tools', false)) - { - include("$phpbb_root_path/includes/db/db_tools.$phpEx"); - } $db_tool = new phpbb_db_tools($db); return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE); @@ -297,12 +293,8 @@ class phpbb_captcha_qa */ function install() { - global $db, $phpbb_root_path, $phpEx; + global $db; - if (!class_exists('phpbb_db_tools')) - { - include("$phpbb_root_path/includes/db/db_tools.$phpEx"); - } $db_tool = new phpbb_db_tools($db); $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 7bd12d358d..428dcfec4a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5401,8 +5401,6 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_UPLOAD' => $config['upload_path'], 'SITE_LOGO_IMG' => $user->img('site_logo'), - - 'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')), )); // application/xhtml+xml not used because of IE diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php index f63dde0614..7cbfa17a0e 100644 --- a/phpBB/includes/functions_container.php +++ b/phpBB/includes/functions_container.php @@ -118,7 +118,10 @@ function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext) */ function phpbb_create_install_container($phpbb_root_path, $php_ext) { - $core = new phpbb_di_extension_core($phpbb_root_path); + $other_config_path = $phpbb_root_path . 'install/update/new/config/'; + $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/'; + + $core = new phpbb_di_extension_core($config_path); $container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext); $container->setParameter('core.root_path', $phpbb_root_path); @@ -136,6 +139,32 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext) } /** +* Create updater container +* +* @param string $phpbb_root_path Root path +* @param string $php_ext PHP Extension +* @param array $config_path Path to config directory +* @return ContainerBuilder object (compiled) +*/ +function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path) +{ + $config_file = $phpbb_root_path . 'config.' . $php_ext; + return phpbb_create_compiled_container( + $config_file, + array( + new phpbb_di_extension_config($config_file), + new phpbb_di_extension_core($config_path), + ), + array( + new phpbb_di_pass_collection_pass(), + new phpbb_di_pass_kernel_pass(), + ), + $phpbb_root_path, + $php_ext + ); +} + +/** * Create a compiled ContainerBuilder object * * @param array $extensions Array of Container extension objects @@ -146,11 +175,6 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext) */ function phpbb_create_compiled_container($config_file, array $extensions, array $passes, $phpbb_root_path, $php_ext) { - $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); - // Create the final container to be compiled and cached $container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext); @@ -231,11 +255,14 @@ function phpbb_create_dumped_container_unless_debug($config_file, array $extensi function phpbb_create_default_container($phpbb_root_path, $php_ext) { $config_file = $phpbb_root_path . 'config.' . $php_ext; + $installed_exts = phpbb_bootstrap_enabled_exts($config_file, $phpbb_root_path); + return phpbb_create_dumped_container_unless_debug( $config_file, array( new phpbb_di_extension_config($config_file), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), + new phpbb_di_extension_ext($installed_exts), ), array( new phpbb_di_pass_collection_pass(), diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index c54cc25f34..05d3c5fde2 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -413,7 +413,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text static $bbcode; global $phpbb_dispatcher; - if (!$text) + if ($text === '') { return ''; } @@ -505,7 +505,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb $uid = $bitfield = ''; $flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0); - if (!$text) + if ($text === '') { return; } 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_messenger.php b/phpBB/includes/functions_messenger.php index 0222a57bcc..3bfc1a44f0 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) */ class messenger { - var $vars, $msg, $extra_headers, $replyto, $from, $subject; + var $msg, $extra_headers, $replyto, $from, $subject; var $addresses = array(); var $mail_priority = MAIL_NORMAL_PRIORITY; @@ -53,7 +53,7 @@ class messenger function reset() { $this->addresses = $this->extra_headers = array(); - $this->vars = $this->msg = $this->replyto = $this->from = ''; + $this->msg = $this->replyto = $this->from = ''; $this->mail_priority = MAIL_NORMAL_PRIORITY; } @@ -258,8 +258,6 @@ class messenger 'body' => $template_file . '.txt', )); - $this->vars = $this->template->get_template_vars(); - return true; } @@ -288,26 +286,11 @@ class messenger global $config, $user; // We add some standard variables we always use, no need to specify them always - if (!isset($this->vars['U_BOARD'])) - { - $this->assign_vars(array( - 'U_BOARD' => generate_board_url(), - )); - } - - if (!isset($this->vars['EMAIL_SIG'])) - { - $this->assign_vars(array( - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), - )); - } - - if (!isset($this->vars['SITENAME'])) - { - $this->assign_vars(array( - 'SITENAME' => htmlspecialchars_decode($config['sitename']), - )); - } + $this->assign_vars(array( + 'U_BOARD' => generate_board_url(), + 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), + 'SITENAME' => htmlspecialchars_decode($config['sitename']), + )); // Parse message through template $this->msg = trim($this->template->assign_display('body')); @@ -660,7 +643,7 @@ class messenger { $this->setup_template(); - $this->template->set_style_names(array($path_name), $paths); + $this->template->set_custom_style($path_name, $paths); } } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 99c24fcb19..8f0f6a837a 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, $phpbb_style; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $template; $module_path = $this->include_path . $this->p_class; $icat = request_var('icat', ''); @@ -508,7 +508,7 @@ class p_master if (is_dir($module_style_dir)) { - $phpbb_style->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), array(), ''); + $template->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style')); } } @@ -537,7 +537,7 @@ class p_master if (is_dir($phpbb_root_path . $module_style_dir)) { - $phpbb_style->set_style(array($module_style_dir, 'styles')); + $template->set_style(array($module_style_dir, 'styles')); } } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 03565c27bb..6e62c0c6e4 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1095,25 +1095,20 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $poster_id = $row['user_id']; $post_subject = $row['post_subject']; - $message = censor_text($row['post_text']); $decoded_message = false; if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) { - $decoded_message = $message; + $decoded_message = censor_text($row['post_text']); decode_message($decoded_message, $row['bbcode_uid']); $decoded_message = bbcode_nl2br($decoded_message); } - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message, !$row['enable_smilies']); + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); + $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true); if (!empty($attachments[$row['post_id']])) { @@ -1995,6 +1990,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } } + $first_post_has_topic_info = ($post_mode == 'edit_first_post' && + (($post_visibility == ITEM_DELETED && $data['topic_posts_softdeleted'] == 1) || + ($post_visibility == ITEM_UNAPPROVED && $data['topic_posts_unapproved'] == 1) || + ($post_visibility == ITEM_APPROVED && $data['topic_posts_approved'] == 1))); // Fix the post's and topic's visibility and first/last post information, when the post is edited if (($post_mode != 'post' && $post_mode != 'reply') && $data['post_visibility'] != $post_visibility) { @@ -2007,7 +2006,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u $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); } - else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies'])) + else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_has_topic_info) { if ($post_visibility == ITEM_APPROVED || $data['topic_visibility'] == $post_visibility) { diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 14278a2529..5fc6de8e02 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -2018,14 +2018,11 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $decoded_message = bbcode_nl2br($decoded_message); } - - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message, !$row['enable_smilies']); + + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $parse_flags |= ($row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0); + + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); $subject = censor_text($subject); diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 99ff397a66..cb61b25174 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -115,17 +115,9 @@ class mcp_pm_reports } // Process message, leave it uncensored - $message = $pm_info['message_text']; + $parse_flags = ($pm_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($pm_info['message_text'], $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield'], $parse_flags, false); - if ($pm_info['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($pm_info['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); $report['report_text'] = make_clickable(bbcode_nl2br($report['report_text'])); if ($pm_info['message_attachment'] && $auth->acl_get('u_pm_download')) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 734fa96a78..06f27655ae 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -125,17 +125,8 @@ function mcp_post_details($id, $mode, $action) $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = $post_info['post_text']; - - if ($post_info['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($post_info['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 8a9390212f..1fa89af8e1 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -206,17 +206,8 @@ class mcp_queue $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; // Process message, leave it uncensored - $message = $post_info['post_text']; - - if ($post_info['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($post_info['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false); if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) { diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 72400ce623..3f48c58073 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&mode=report_details&f=' . $post_info['forum_id'] . '&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_visibility'] == POST_UNAPPROVED), + 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED), 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index d0e4a2e057..9c294b96c8 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -207,13 +207,8 @@ function mcp_topic_view($id, $mode, $action) $message = $row['post_text']; $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); if (!empty($attachments[$row['post_id']])) { @@ -674,10 +669,10 @@ function merge_posts($topic_id, $to_topic_id) } // If the topic no longer exist, we will update the topic watch table. - phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id); + phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', array($topic_id), $to_topic_id); // If the topic no longer exist, we will update the bookmarks table. - phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_id, $to_topic_id); + phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', array($topic_id), $to_topic_id); } // Link to the new topic diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 4ef477775d..bb21d3d377 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -289,19 +289,8 @@ class mcp_warn // We want to make the message available here as a reminder // Parse the message and subject - $message = censor_text($user_row['post_text']); - - // Second parse bbcode here - if ($user_row['bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - - $bbcode = new bbcode($user_row['bbcode_bitfield']); - $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = OPTION_FLAG_SMILIES | ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0); + $message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], $parse_flags, true); // Generate the appropriate user information for the user we are looking at if (!function_exists('phpbb_get_user_avatar')) diff --git a/phpBB/includes/style/extension_path_provider.php b/phpBB/includes/style/extension_path_provider.php deleted file mode 100644 index ec1d85f821..0000000000 --- a/phpBB/includes/style/extension_path_provider.php +++ /dev/null @@ -1,137 +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; -} - -/** -* Provides a style resource locator with core style paths and extension style paths -* -* Finds installed style paths and makes them available to the resource locator. -* -* @package phpBB3 -*/ -class phpbb_style_extension_path_provider extends phpbb_extension_provider implements phpbb_style_path_provider_interface -{ - /** - * Optional prefix for style paths searched within extensions. - * - * Empty by default. Relative to the extension directory. As an example, it - * could be adm/ for admin style. - * - * @var string - */ - protected $ext_dir_prefix = ''; - - /** - * A provider of paths to be searched for styles - * @var phpbb_style_path_provider - */ - protected $base_path_provider; - - /** @var string */ - protected $phpbb_root_path; - - /** - * Constructor stores extension manager - * - * @param phpbb_extension_manager $extension_manager phpBB extension manager - * @param phpbb_style_path_provider $base_path_provider A simple path provider - * to provide paths to be located in extensions - * @param string $phpbb_root_path phpBB root path - */ - public function __construct(phpbb_extension_manager $extension_manager, phpbb_style_path_provider $base_path_provider, $phpbb_root_path) - { - parent::__construct($extension_manager); - $this->base_path_provider = $base_path_provider; - $this->phpbb_root_path = $phpbb_root_path; - } - - /** - * Sets a prefix for style paths searched within extensions. - * - * The prefix is inserted between the extension's path e.g. ext/foo/ and - * the looked up style path, e.g. styles/bar/. So it should not have a - * leading slash, but should have a trailing slash. - * - * @param string $ext_dir_prefix The prefix including trailing slash - * @return null - */ - public function set_ext_dir_prefix($ext_dir_prefix) - { - $this->ext_dir_prefix = $ext_dir_prefix; - } - - /** - * Finds style paths using the extension manager - * - * Locates a path (e.g. styles/prosilver/) in all active extensions. - * Then appends the core style paths based in the current working - * directory. - * - * @return array List of style paths - */ - public function find() - { - $directories = array(); - - $finder = $this->extension_manager->get_finder(); - foreach ($this->base_path_provider as $key => $paths) - { - if ($key == 'style') - { - foreach ($paths as $path) - { - $directories['style'][] = $path; - if ($path && !phpbb_is_absolute($path)) - { - // Remove phpBB root path from the style path, - // so the finder is able to find extension styles, - // when the root path is not ./ - if (strpos($path, $this->phpbb_root_path) === 0) - { - $path = substr($path, strlen($this->phpbb_root_path)); - } - - $result = $finder->directory('/' . $this->ext_dir_prefix . $path) - ->get_directories(true, false, true); - foreach ($result as $ext => $ext_path) - { - // Make sure $ext_path has no ending slash - if (substr($ext_path, -1) === '/') - { - $ext_path = substr($ext_path, 0, -1); - } - $directories[$ext][] = $ext_path; - } - } - } - } - } - - return $directories; - } - - /** - * Overwrites the current style paths - * - * @param array $styles An array of style paths. The first element is the main style. - * @return null - */ - public function set_styles(array $styles) - { - $this->base_path_provider->set_styles($styles); - $this->items = null; - } -} diff --git a/phpBB/includes/style/path_provider.php b/phpBB/includes/style/path_provider.php deleted file mode 100644 index 731d682e88..0000000000 --- a/phpBB/includes/style/path_provider.php +++ /dev/null @@ -1,62 +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; -} - -/** -* Provides a style resource locator with paths -* -* Finds installed style paths and makes them available to the resource locator. -* -* @package phpBB3 -*/ -class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_provider_interface -{ - protected $paths = array(); - - /** - * Ignores the extension dir prefix - * - * @param string $ext_dir_prefix The prefix including trailing slash - * @return null - */ - public function set_ext_dir_prefix($ext_dir_prefix) - { - } - - /** - * Overwrites the current style paths - * - * The first element of the passed styles map, is considered the main - * style. - * - * @param array $styles An array of style paths. The first element is the main style. - * @return null - */ - public function set_styles(array $styles) - { - $this->paths = array('style' => $styles); - } - - /** - * Retrieve an iterator over all style paths - * - * @return ArrayIterator An iterator for the array of style paths - */ - public function getIterator() - { - return new ArrayIterator($this->paths); - } -} diff --git a/phpBB/includes/style/path_provider_interface.php b/phpBB/includes/style/path_provider_interface.php deleted file mode 100644 index 1a6153a4d3..0000000000 --- a/phpBB/includes/style/path_provider_interface.php +++ /dev/null @@ -1,42 +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; -} - -/** -* Provides a style resource locator with paths -* -* Finds installed style paths and makes them available to the resource locator. -* -* @package phpBB3 -*/ -interface phpbb_style_path_provider_interface extends Traversable -{ - /** - * Defines a prefix to use for style paths in extensions - * - * @param string $ext_dir_prefix The prefix including trailing slash - * @return null - */ - public function set_ext_dir_prefix($ext_dir_prefix); - - /** - * Overwrites the current style paths - * - * @param array $styles An array of style paths. The first element is the main style. - * @return null - */ - public function set_styles(array $styles); -} diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/includes/style/resource_locator.php deleted file mode 100644 index 4cf767c062..0000000000 --- a/phpBB/includes/style/resource_locator.php +++ /dev/null @@ -1,348 +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; -} - - -/** -* Style resource locator. -* Maintains mapping from template handles to source template file paths. -* Locates style files: resources (such as .js and .css files) and templates. -* -* Style resource locator is aware of styles tree, and can return actual -* filesystem paths (i.e., the "child" style or the "parent" styles) -* depending on what files exist. -* -* Root paths stored in locator are paths to style directories. Templates are -* stored in subdirectory that $template_path points to. -* -* @package phpBB3 -*/ -class phpbb_style_resource_locator implements phpbb_template_locator -{ - /** - * Paths to style directories. - * @var array - */ - private $roots = array(); - - /** - * Location of templates directory within style directories. - * Must have trailing slash. Empty if templates are stored in root - * style directory, such as admin control panel templates. - * @var string - */ - private $template_path; - - /** - * Map from root index to handles to source template file paths. - * Normally it only contains paths for handles that are used - * (or are likely to be used) by the page being rendered and not - * all templates that exist on the filesystem. - * @var array - */ - private $files = array(); - - /** - * Map from handles to source template file names. - * Covers the same data as $files property but maps to basenames - * instead of paths. - * @var array - */ - private $filenames = array(); - - /** - * Constructor. - * - * Sets default template path to template/. - */ - public function __construct() - { - $this->set_default_template_path(); - } - - /** - * Sets the list of style paths - * - * These paths will be searched for style files in the provided order. - * Paths may be outside of phpBB, but templates loaded from these paths - * will still be cached. - * - * @param array $style_paths An array of paths to style directories - * @return null - */ - public function set_paths($style_paths) - { - $this->roots = array(); - $this->files = array(); - $this->filenames = array(); - - foreach ($style_paths as $key => $paths) - { - foreach ($paths as $path) - { - // Make sure $path has no ending slash - if (substr($path, -1) === '/') - { - $path = substr($path, 0, -1); - } - $this->roots[$key][] = $path; - } - } - } - - /** - * Sets the location of templates directory within style directories. - * - * The location must be a relative path, with a trailing slash. - * Typically it is one directory level deep, e.g. "template/". - * - * @param string $template_path Relative path to templates directory within style directories - * @return null - */ - public function set_template_path($template_path) - { - $this->template_path = $template_path; - } - - /** - * Sets the location of templates directory within style directories - * to the default, which is "template/". - * - * @return null - */ - public function set_default_template_path() - { - $this->template_path = 'template/'; - } - - /** - * {@inheritDoc} - */ - public function set_filenames(array $filename_array) - { - foreach ($filename_array as $handle => $filename) - { - if (empty($filename)) - { - trigger_error("style resource locator: set_filenames: Empty filename specified for $handle", E_USER_ERROR); - } - - $this->filename[$handle] = $filename; - - foreach ($this->roots as $root_key => $root_paths) - { - foreach ($root_paths as $root_index => $root) - { - $this->files[$root_key][$root_index][$handle] = $root . '/' . $this->template_path . $filename; - } - } - } - } - - /** - * {@inheritDoc} - */ - public function get_filename_for_handle($handle) - { - if (!isset($this->filename[$handle])) - { - trigger_error("style resource locator: get_filename_for_handle: No file specified for handle $handle", E_USER_ERROR); - } - return $this->filename[$handle]; - } - - /** - * {@inheritDoc} - */ - public function get_virtual_source_file_for_handle($handle) - { - // If we don't have a file assigned to this handle, die. - if (!isset($this->files['style'][0][$handle])) - { - trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR); - } - - $source_file = $this->files['style'][0][$handle]; - return $source_file; - } - - /** - * {@inheritDoc} - */ - public function get_source_file_for_handle($handle, $find_all = false) - { - // If we don't have a file assigned to this handle, die. - if (!isset($this->files['style'][0][$handle])) - { - trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR); - } - - // locate a source file that exists - $source_file = $this->files['style'][0][$handle]; - $tried = $source_file; - $found = false; - $found_all = array(); - foreach ($this->roots as $root_key => $root_paths) - { - foreach ($root_paths as $root_index => $root) - { - $source_file = $this->files[$root_key][$root_index][$handle]; - $tried .= ', ' . $source_file; - if (file_exists($source_file)) - { - $found = true; - break; - } - } - if ($found) - { - if ($find_all) - { - $found_all[] = $source_file; - $found = false; - } - else - { - break; - } - } - } - - // search failed - if (!$found && !$find_all) - { - trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR); - } - - return ($find_all) ? $found_all : $source_file; - } - - /** - * {@inheritDoc} - */ - public function get_first_file_location($files, $return_default = false, $return_full_path = true) - { - // set default value - $default_result = false; - - // check all available paths - foreach ($this->roots as $root_paths) - { - foreach ($root_paths as $path) - { - // check all files - foreach ($files as $filename) - { - $source_file = $path . '/' . $filename; - if (file_exists($source_file)) - { - return ($return_full_path) ? $source_file : $filename; - } - - // assign first file as result if $return_default is true - if ($return_default && $default_result === false) - { - $default_result = $source_file; - } - } - } - } - - // search failed - return $default_result; - } - - /** - * Obtains filesystem path for a template file. - * - * The simplest use is specifying a single template file as a string - * in the first argument. This template file should be a basename - * of a template file in the selected style, or its parent styles - * if template inheritance is being utilized. - * - * Note: "selected style" is whatever style the style resource locator - * is configured for. - * - * The return value then will be a path, relative to the current - * directory or absolute, to the template file in the selected style - * or its closest parent. - * - * If the selected style does not have the template file being searched, - * (and if inheritance is involved, none of the parents have it either), - * false will be returned. - * - * Specifying true for $return_default will cause the function to - * return the first path which was checked for existence in the event - * that the template file was not found, instead of false. - * This is the path in the selected style itself, not any of its - * parents. - * - * $files can be given an array of templates instead of a single - * template. When given an array, the function will try to resolve - * each template in the array to a path, and will return the first - * path that exists, or false if none exist. - * - * If $files is an array and template inheritance is involved, first - * each of the files will be checked in the selected style, then each - * of the files will be checked in the immediate parent, and so on. - * - * If $return_full_path is false, then instead of returning a usable - * path (when the template is found) only the template's basename - * will be returned. This can be used to check which of the templates - * specified in $files exists. Naturally more than one template must - * be given in $files. - * - * This function works identically to get_first_file_location except - * it operates on a list of templates, not files. Practically speaking, - * the templates given in the first argument first are prepended with - * the template path (property in this class), then given to - * get_first_file_location for the rest of the processing. - * - * Templates given to this function can be relative paths for templates - * located in subdirectories of the template directories. The paths - * should be relative to the templates directory (template/ by default). - * - * @param string or array $files List of templates to locate. If there is only - * one template, $files can be a string to make code easier to read. - * @param bool $return_default Determines what to return if template does not - * exist. If true, function will return location where template is - * supposed to be. If false, function will return false. - * @param bool $return_full_path If true, function will return full path - * to template. If false, function will return template file name. - * This parameter can be used to check which one of set of template - * files is available. - * @return string or boolean Source template path if template exists or $return_default is - * true. False if template does not exist and $return_default is false - */ - public function get_first_template_location($templates, $return_default = false, $return_full_path = true) - { - // add template path prefix - $files = array(); - if (is_string($templates)) - { - $files[] = $this->template_path . $templates; - } - else - { - foreach ($templates as $template) - { - $files[] = $this->template_path . $template; - } - } - - return $this->get_first_file_location($files, $return_default, $return_full_path); - } -} diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php deleted file mode 100644 index 034f518091..0000000000 --- a/phpBB/includes/style/style.php +++ /dev/null @@ -1,241 +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; -} - -/** -* Base Style class. -* @package phpBB3 -*/ -class phpbb_style -{ - /** - * Template class. - * Handles everything related to templates. - * @var phpbb_template - */ - private $template; - - /** - * 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; - - /** - * Style resource locator - * @var phpbb_style_resource_locator - */ - private $locator; - - /** - * Style path provider - * @var phpbb_style_path_provider - */ - private $provider; - - /** - * Constructor. - * - * @param string $phpbb_root_path phpBB root path - * @param user $user current user - * @param phpbb_style_resource_locator $locator style resource locator - * @param phpbb_style_path_provider $provider style path provider - * @param phpbb_template $template template - */ - public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_style_resource_locator $locator, phpbb_style_path_provider_interface $provider, phpbb_template $template) - { - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; - $this->config = $config; - $this->user = $user; - $this->locator = $locator; - $this->provider = $provider; - $this->template = $template; - } - - /** - * Get the style tree of the style preferred by the current user - * - * @return array Style tree, most specific first - */ - public function get_user_style() - { - $style_list = array( - $this->user->style['style_path'], - ); - - if ($this->user->style['style_parent_id']) - { - $style_list = array_merge($style_list, array_reverse(explode('/', $this->user->style['style_parent_tree']))); - } - - 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 ($style_directories as $directory) - { - foreach ($this->names as $name) - { - $path = $this->get_style_path($name, $directory); - - if (is_dir($path)) - { - $paths[] = $path; - } - } - } - - $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; - } - - /** - * Set custom style location (able to use directory outside of phpBB). - * - * Note: Templates are still compiled to phpBB's cache directory. - * - * @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver" - * @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) - { - if (is_string($paths)) - { - $paths = array($paths); - } - - if (empty($names)) - { - $names = array($name); - } - $this->names = $names; - - $this->provider->set_styles($paths); - $this->locator->set_paths($this->provider); - - if ($template_path !== false) - { - $this->locator->set_template_path($template_path); - } - - $new_paths = array(); - foreach ($paths as $path) - { - $new_paths[] = $path . '/' . (($template_path !== false) ? $template_path : 'template/'); - } - - $this->template->set_style_names($names, $new_paths); - - return true; - } - - /** - * 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, $style_base_directory = 'styles') - { - return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path; - } - - /** - * Defines a prefix to use for style paths in extensions - * - * @param string $ext_dir_prefix The prefix including trailing slash - * @return null - */ - public function set_ext_dir_prefix($ext_dir_prefix) - { - $this->provider->set_ext_dir_prefix($ext_dir_prefix); - } - - /** - * Locates source file path, accounting for styles tree and verifying that - * the path exists. - * - * @param string or array $files List of files to locate. If there is only - * one file, $files can be a string to make code easier to read. - * @param bool $return_default Determines what to return if file does not - * exist. If true, function will return location where file is - * supposed to be. If false, function will return false. - * @param bool $return_full_path If true, function will return full path - * to file. If false, function will return file name. This - * parameter can be used to check which one of set of files - * is available. - * @return string or boolean Source file path if file exists or $return_default is - * true. False if file does not exist and $return_default is false - */ - public function locate($files, $return_default = false, $return_full_path = true) - { - // convert string to array - if (is_string($files)) - { - $files = array($files); - } - - // use resource locator to find files - return $this->locator->get_first_file_location($files, $return_default, $return_full_path); - } -} diff --git a/phpBB/includes/template/locator.php b/phpBB/includes/template/locator.php deleted file mode 100644 index f6fd20bcc2..0000000000 --- a/phpBB/includes/template/locator.php +++ /dev/null @@ -1,163 +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; -} - - -/** -* Resource locator interface. -* -* Objects implementing this interface maintain mapping from template handles -* to source template file paths and locate templates. -* -* Locates style files. -* -* Resource locator is aware of styles tree, and can return actual -* filesystem paths (i.e., the "child" style or the "parent" styles) -* depending on what files exist. -* -* Root paths stored in locator are paths to style directories. Templates are -* stored in subdirectory that $template_path points to. -* -* @package phpBB3 -*/ -interface phpbb_template_locator -{ - /** - * Sets the template filenames for handles. $filename_array - * should be a hash of handle => filename pairs. - * - * @param array $filename_array Should be a hash of handle => filename pairs. - */ - public function set_filenames(array $filename_array); - - /** - * Determines the filename for a template handle. - * - * The filename comes from array used in a set_filenames call, - * which should have been performed prior to invoking this function. - * Return value is a file basename (without path). - * - * @param $handle string Template handle - * @return string Filename corresponding to the template handle - */ - public function get_filename_for_handle($handle); - - /** - * Determines the source file path for a template handle without - * regard for styles tree. - * - * This function returns the path in "primary" style directory - * corresponding to the given template handle. That path may or - * may not actually exist on the filesystem. Because this function - * does not perform stat calls to determine whether the path it - * returns actually exists, it is faster than get_source_file_for_handle. - * - * Use get_source_file_for_handle to obtain the actual path that is - * guaranteed to exist (which might come from the parent style - * directory if primary style has parent styles). - * - * This function will trigger an error if the handle was never - * associated with a template file via set_filenames. - * - * @param $handle string Template handle - * @return string Path to source file path in primary style directory - */ - public function get_virtual_source_file_for_handle($handle); - - /** - * Determines the source file path for a template handle, accounting - * for styles tree and verifying that the path exists. - * - * This function returns the actual path that may be compiled for - * the specified template handle. It will trigger an error if - * the template handle was never associated with a template path - * via set_filenames or if the template file does not exist on the - * filesystem. - * - * Use get_virtual_source_file_for_handle to just resolve a template - * handle to a path without any filesystem or styles tree checks. - * - * @param string $handle Template handle (i.e. "friendly" template name) - * @param bool $find_all If true, each root path will be checked and function - * will return array of files instead of string and will not - * trigger a error if template does not exist - * @return string Source file path - */ - public function get_source_file_for_handle($handle, $find_all = false); - - /** - * Obtains a complete filesystem path for a file in a style. - * - * This function traverses the style tree (selected style and - * its parents in order, if inheritance is being used) and finds - * the first file on the filesystem matching specified relative path, - * or the first of the specified paths if more than one path is given. - * - * This function can be used to determine filesystem path of any - * file under any style, with the consequence being that complete - * relative to the style directory path must be provided as an argument. - * - * In particular, this function can be used to locate templates - * and javascript files. - * - * For locating templates get_first_template_location should be used - * as it prepends the configured template path to the template basename. - * - * Note: "selected style" is whatever style the style resource locator - * is configured for. - * - * The return value then will be a path, relative to the current - * directory or absolute, to the first existing file in the selected - * style or its closest parent. - * - * If the selected style does not have the file being searched, - * (and if inheritance is involved, none of the parents have it either), - * false will be returned. - * - * Multiple files can be specified, in which case the first file in - * the list that can be found on the filesystem is returned. - * - * If multiple files are specified and inheritance is involved, - * first each of the specified files is checked in the selected style, - * then each of the specified files is checked in the immediate parent, - * etc. - * - * Specifying true for $return_default will cause the function to - * return the first path which was checked for existence in the event - * that the template file was not found, instead of false. - * This is always a path in the selected style itself, not any of its - * parents. - * - * If $return_full_path is false, then instead of returning a usable - * path (when the file is found) the file's path relative to the style - * directory will be returned. This is the same path as was given to - * the function as a parameter. This can be used to check which of the - * files specified in $files exists. Naturally this requires passing - * more than one file in $files. - * - * @param array $files List of files to locate. - * @param bool $return_default Determines what to return if file does not - * exist. If true, function will return location where file is - * supposed to be. If false, function will return false. - * @param bool $return_full_path If true, function will return full path - * to file. If false, function will return file name. This - * parameter can be used to check which one of set of files - * is available. - * @return string or boolean Source file path if file exists or $return_default is - * true. False if file does not exist and $return_default is false - */ - public function get_first_file_location($files, $return_default = false, $return_full_path = true); -} diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php deleted file mode 100644 index 92a37d1634..0000000000 --- a/phpBB/includes/template/twig/twig.php +++ /dev/null @@ -1,465 +0,0 @@ -<?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/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index b7d2dd6821..c7b4489daf 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -76,17 +76,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $user_info = get_user_information($author_id, $message_row); // Parse the message and subject - $message = censor_text($message_row['message_text']); - - // Second parse bbcode here - if ($message_row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $message_row['bbcode_uid'], $message_row['bbcode_bitfield']); - } - - // Always process smilies after parsing bbcodes - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($message_row['message_text'], $message_row['bbcode_uid'], $message_row['bbcode_bitfield'], $parse_flags, true); // Replace naughty words such as farty pants $message_row['message_subject'] = censor_text($message_row['message_subject']); @@ -160,21 +151,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) // End signature parsing, only if needed if ($signature) { - $signature = censor_text($signature); - - if ($user_info['user_sig_bbcode_bitfield']) - { - if ($bbcode === false) - { - include($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode($user_info['user_sig_bbcode_bitfield']); - } - - $bbcode->bbcode_second_pass($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield']); - } - - $signature = bbcode_nl2br($signature); - $signature = smiley_text($signature); + $parse_flags = ($user_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $signature = generate_text_for_display($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield'], $parse_flags, true); } $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 7c3286c1d1..f24578da84 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -267,7 +267,7 @@ class ucp_prefs $limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); - $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); + $sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views'); // Post ordering options $limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 55df5f610c..e55569fdd5 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -546,6 +546,9 @@ class ucp_profile // Build custom bbcodes array display_custom_bbcodes(); + // Generate smiley listing + generate_smilies('inline', 0); + break; case 'avatar': diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 70fbfe46fb..7bc7ac8191 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -38,7 +38,7 @@ class ucp_register include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); $coppa = $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false; - $agreed = (int) $request->variable('agreed', false); + $agreed = $request->variable('agreed', false); $submit = $request->is_set_post('submit'); $change_lang = request_var('change_lang', ''); $user_lang = request_var('lang', $user->lang_name); @@ -63,7 +63,7 @@ class ucp_register $submit = false; // Setting back agreed to let the user view the agreement in his/her language - $agreed = ($request->variable('change_lang', false)) ? 0 : $agreed; + $agreed = false; } $user->lang_name = $user_lang = $use_lang; @@ -89,7 +89,7 @@ class ucp_register $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; $s_hidden_fields = array( - 'change_lang' => $change_lang, + 'change_lang' => '', ); // If we change the language, we want to pass on some more possible parameter. diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index ff7ab53736..bdbf693ddd 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -101,6 +101,8 @@ class ucp_remind $messenger->set_addresses($user_row); + $messenger->anti_abuse_headers($config, $user); + $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b20ca1e4ea..3be5ea659c 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -21,26 +21,6 @@ define('IN_INSTALL', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -if (!function_exists('phpbb_require_updated')) -{ - function phpbb_require_updated($path, $optional = false) - { - global $phpbb_root_path; - - $new_path = $phpbb_root_path . 'install/update/new/' . $path; - $old_path = $phpbb_root_path . $path; - - if (file_exists($new_path)) - { - require($new_path); - } - else if (!$optional || file_exists($old_path)) - { - require($old_path); - } - } -} - function phpbb_end_update($cache, $config) { $cache->purge(); @@ -69,7 +49,7 @@ function phpbb_end_update($cache, $config) exit_handler(); } -phpbb_require_updated('includes/startup.' . $phpEx); +require($phpbb_root_path . 'includes/startup.' . $phpEx); include($phpbb_root_path . 'config.' . $phpEx); if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) @@ -82,30 +62,31 @@ $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); require($phpbb_root_path . 'includes/functions_container.' . $phpEx); +require($phpbb_root_path . 'config.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); +include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); // Setup class loader first -$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}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) $container_extensions = array( new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config/'), ); $container_passes = array( new phpbb_di_pass_collection_pass(), - //new phpbb_di_pass_kernel_pass(), ); $phpbb_container = phpbb_create_container($container_extensions, $phpbb_root_path, $phpEx); @@ -217,7 +198,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); @@ -263,8 +244,8 @@ while (!$migrator->finished()) // Are we approaching the time limit? If so we want to pause the update and continue after refreshing if ((time() - $update_start_time) >= $safe_time_limit) { - echo $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br />'; - echo '<a href="' . append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=' . $request->variable('type', 0) . '&language=' . $user->lang['USER_LANG']) . '">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>'; + echo '<br />' . $user->lang['DATABASE_UPDATE_NOT_COMPLETED'] . '<br /><br />'; + echo '<a href="' . append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=' . $request->variable('type', 0) . '&language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['DATABASE_UPDATE_CONTINUE'] . '</a>'; phpbb_end_update($cache, $config); } @@ -280,7 +261,7 @@ echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '<br />'; if ($request->variable('type', 0)) { echo $user->lang['INLINE_UPDATE_SUCCESSFUL'] . '<br /><br />'; - echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&sub=file_check&language=' . $user->lang['USER_LANG']) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>'; + echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&sub=update_db&language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>'; } else { diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 84a2a023f8..530728bdba 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -28,7 +28,7 @@ if (version_compare(PHP_VERSION, '5.3.3') < 0) function phpbb_require_updated($path, $optional = false) { - global $phpbb_root_path; + global $phpbb_root_path, $table_prefix; $new_path = $phpbb_root_path . 'install/update/new/' . $path; $old_path = $phpbb_root_path . $path; @@ -43,6 +43,23 @@ function phpbb_require_updated($path, $optional = false) } } +function phpbb_include_updated($path, $optional = false) +{ + global $phpbb_root_path; + + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + include($new_path); + } + else if (!$optional || file_exists($old_path)) + { + include($old_path); + } +} + phpbb_require_updated('includes/startup.' . $phpEx); // Try to override some limits - maybe it helps some... @@ -78,19 +95,22 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include essential scripts -require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +phpbb_require_updated('phpbb/class_loader.' . $phpEx); -require($phpbb_root_path . 'includes/functions.' . $phpEx); -require($phpbb_root_path . 'includes/functions_container.' . $phpEx); +phpbb_require_updated('includes/functions.' . $phpEx); +phpbb_require_updated('includes/functions_container.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx, true); -include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); -include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); -require($phpbb_root_path . 'includes/functions_install.' . $phpEx); +phpbb_include_updated('includes/functions_admin.' . $phpEx); +phpbb_include_updated('includes/utf/utf_normalizer.' . $phpEx); +phpbb_include_updated('includes/utf/utf_tools.' . $phpEx); +phpbb_require_updated('includes/functions_install.' . $phpEx); // Setup class loader first -$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx); +$phpbb_class_loader_new = 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}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(); @@ -108,7 +128,7 @@ $request = $phpbb_container->get('request'); request_var('', 0, false, false, $request); // "dependency injection" for a function // Try and load an appropriate language if required -$language = basename(request_var('language', '')); +$language = basename($request->variable('language', '')); if ($request->header('Accept-Language') && !$language) { @@ -167,11 +187,23 @@ if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_r } // And finally, load the relevant language files -include($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/acp/common.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/acp/board.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/posting.' . $phpEx); +$load_lang_files = array('common', 'acp/common', 'acp/board', 'install', 'posting'); +$new_path = $phpbb_root_path . 'install/update/new/language/' . $language . '/'; +$old_path = $phpbb_root_path . 'language/' . $language . '/'; + +// NOTE: we can not use "phpbb_include_updated" as the files uses vars which would be required +// to be global while loading. +foreach ($load_lang_files as $lang_file) +{ + if (file_exists($new_path . $lang_file . '.' . $phpEx)) + { + include($new_path . $lang_file . '.' . $phpEx); + } + else + { + include($old_path . $lang_file . '.' . $phpEx); + } +} // usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :( @@ -181,8 +213,8 @@ define('CHMOD_READ', 4); define('CHMOD_WRITE', 2); define('CHMOD_EXECUTE', 1); -$mode = request_var('mode', 'overview'); -$sub = request_var('sub', ''); +$mode = $request->variable('mode', 'overview'); +$sub = $request->variable('sub', ''); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); @@ -212,12 +244,11 @@ $config = new phpbb_config(array( 'load_tplcompile' => '1' )); -$phpbb_style_resource_locator = new phpbb_style_resource_locator(); -$phpbb_style_path_provider = new phpbb_style_path_provider(); $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(), ''); +$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); +$paths = array_filter($paths, 'is_dir'); +$template->set_custom_style('admin', $paths); + $template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 3d7b6f7c88..ea23c318e3 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1435,7 +1435,7 @@ class install_install extends module $db->sql_return_on_error(true); include_once($phpbb_root_path . 'includes/constants.' . $phpEx); - include_once($phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx); + include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx); // We need to fill the config to let internal functions correctly work $config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE); @@ -1888,7 +1888,7 @@ class install_install extends module /** * Populate migrations for the installation * - * This "installs" all migrations from (root path)/includes/db/migrations/data. + * This "installs" all migrations from (root path)/phpbb/db/migrations/data. * "installs" means it adds all migrations to the migrations table, but does not * perform any of the actions in the migrations. * @@ -1900,7 +1900,7 @@ class install_install extends module $finder = $extension_manager->get_finder(); $migrations = $finder - ->core_path('includes/db/migration/data/') + ->core_path('phpbb/db/migration/data/') ->get_classes(); $migrator->populate_migrations($migrations); } diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index df9b6c1c7e..a569e0ad9a 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -39,7 +39,7 @@ if (!empty($setmodules)) 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), 'module_order' => 30, 'module_subs' => '', - 'module_stages' => array('INTRO', 'VERSION_CHECK', 'UPDATE_DB', 'FILE_CHECK', 'UPDATE_FILES'), + 'module_stages' => array('INTRO', 'VERSION_CHECK', 'FILE_CHECK', 'UPDATE_FILES', 'UPDATE_DB'), 'module_reqs' => '' ); } @@ -57,7 +57,6 @@ class install_update extends module var $new_location; var $latest_version; var $current_version; - var $unequal_version; var $update_to_version; @@ -71,18 +70,22 @@ class install_update extends module function main($mode, $sub) { - global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; + global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container; + // We must enable super globals, otherwise creating a new instance of the request class, + // using the new container with a dbal connection will fail with the following PHP Notice: + // Object of class phpbb_request_deactivated_super_global could not be converted to int + $request->enable_super_globals(); + // Create a normal container now - $phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx); + $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config'); // Writes into global $cache $cache = $phpbb_container->get('cache'); $this->tpl_name = 'install_update'; $this->page_title = 'UPDATE_INSTALLATION'; - $this->unequal_version = false; $this->old_location = $phpbb_root_path . 'install/update/old/'; $this->new_location = $phpbb_root_path . 'install/update/new/'; @@ -125,7 +128,7 @@ class install_update extends module $config['default_lang'] = $language; $user->data['user_lang'] = $language; - $user->setup(array('common', 'acp/common', 'acp/board', 'install', 'posting')); + $user->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting')); // Reset the default_lang $config['default_lang'] = $config_default_lang; @@ -138,7 +141,9 @@ class install_update extends module } // Set custom template again. ;) - $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); + $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); + $paths = array_filter($paths, 'is_dir'); + $template->set_custom_style('admin', $paths); $template->assign_vars(array( 'S_USER_LANG' => $user->lang['USER_LANG'], @@ -192,8 +197,6 @@ class install_update extends module // Check if the update files are actually meant to update from the current version if ($this->current_version != $this->update_info['version']['from']) { - $this->unequal_version = true; - $template->assign_vars(array( 'S_ERROR' => true, 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $this->current_version, $this->update_info['version']['from'], $this->update_info['version']['to']), @@ -201,10 +204,8 @@ class install_update extends module } // Check if the update files stored are for the latest version... - if ($this->latest_version != $this->update_info['version']['to']) + if (version_compare(strtolower($this->latest_version), strtolower($this->update_info['version']['to']), '>')) { - $this->unequal_version = true; - $template->assign_vars(array( 'S_WARNING' => true, 'WARNING_MSG' => sprintf($user->lang['OLD_UPDATE_FILES'], $this->update_info['version']['from'], $this->update_info['version']['to'], $this->latest_version)) @@ -222,14 +223,15 @@ class install_update extends module if ($this->test_update === false) { - // Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present - if (in_array($phpbb_adm_relative_path . 'style/install_update.html', $this->update_info['files'])) + // What about the language file? Got it updated? + if (in_array('language/' . $language . '/install.' . $phpEx, $this->update_info['files'])) { - $this->tpl_name = '../../install/update/new/adm/style/install_update'; + $lang = array(); + include($this->new_location . 'language/' . $language . '/install.' . $phpEx); + // this is the user's language.. just merge it + $user->lang = array_merge($user->lang, $lang); } - - // What about the language file? Got it updated? - if (in_array('language/en/install.' . $phpEx, $this->update_info['files'])) + if ($language != 'en' && in_array('language/en/install.' . $phpEx, $this->update_info['files'])) { $lang = array(); include($this->new_location . 'language/en/install.' . $phpEx); @@ -273,18 +275,17 @@ class install_update extends module $this->page_title = 'STAGE_VERSION_CHECK'; $template->assign_vars(array( - 'S_UP_TO_DATE' => $up_to_date, 'S_VERSION_CHECK' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), - 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), + 'S_UP_TO_DATE' => $up_to_date, 'LATEST_VERSION' => $this->latest_version, - 'CURRENT_VERSION' => $this->current_version) - ); + 'CURRENT_VERSION' => $this->current_version, + )); // Print out version the update package updates to - if ($this->unequal_version) + if ($this->latest_version != $this->update_info['version']['to']) { $template->assign_var('PACKAGE_VERSION', $this->update_info['version']['to']); } @@ -302,30 +303,6 @@ class install_update extends module break; case 'update_db': - - // Make sure the database update is valid for the latest version - $valid = false; - $updates_to_version = ''; - - if (file_exists($phpbb_root_path . 'install/database_update.' . $phpEx)) - { - include_once($phpbb_root_path . 'install/database_update.' . $phpEx); - - if ($updates_to_version === $this->update_info['version']['to']) - { - $valid = true; - } - } - - // Should not happen at all - if (!$valid) - { - trigger_error($user->lang['DATABASE_UPDATE_INFO_OLD'], E_USER_ERROR); - } - - // Just a precaution - $cache->purge(); - // Redirect the user to the database update script with some explanations... $template->assign_vars(array( 'S_DB_UPDATE' => true, @@ -333,8 +310,14 @@ class install_update extends module 'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&language=' . $user->data['user_lang']), 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), + 'L_EVERYTHING_UP_TO_DATE' => $user->lang('EVERYTHING_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')), )); + // Do not display incompatible package note after successful update + if ($config['version'] == $this->update_info['version']['to']) + { + $template->assign_var('S_ERROR', false); + } break; case 'file_check': @@ -500,17 +483,30 @@ class install_update extends module $template->assign_vars(array( 'S_FILE_CHECK' => true, 'S_ALL_UP_TO_DATE' => $all_up_to_date, - 'L_ALL_FILES_UP_TO_DATE' => $user->lang('ALL_FILES_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')), 'S_VERSION_UP_TO_DATE' => $up_to_date, + 'S_UP_TO_DATE' => $up_to_date, 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), 'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), )); + // Since some people try to update to RC releases, but phpBB.com tells them the last version is the version they currently run + // we are faced with the updater thinking the database schema is up-to-date; which it is, but should be updated none-the-less + // We now try to cope with this by triggering the update process + if (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->update_info['version']['to'])), '<')) + { + $template->assign_vars(array( + 'S_UP_TO_DATE' => false, + )); + } + if ($all_up_to_date) { + global $phpbb_container; + $phpbb_log = $phpbb_container->get('log'); + // Add database update to log - add_log('admin', 'LOG_UPDATE_PHPBB', $this->current_version, $this->update_to_version); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UPDATE_PHPBB', time(), array($this->current_version, $this->update_to_version)); $db->sql_return_on_error(true); $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'"); @@ -1089,12 +1085,6 @@ class install_update extends module $this->tpl_name = 'install_update_diff'; - // Got the diff template itself updated? If so, we are able to directly use it - if (in_array($phpbb_adm_relative_path . 'style/install_update_diff.html', $this->update_info['files'])) - { - $this->tpl_name = '../../install/update/new/adm/style/install_update_diff'; - } - $this->page_title = 'VIEWING_FILE_DIFF'; $status = request_var('status', ''); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index d03fdf9de4..0a31b89aab 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -170,7 +170,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_search_load' INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_anon_lastread', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_birthdays', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_memberlist', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_profile', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_pm', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewprofile', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewtopic', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_lastread', '1'); diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 98679ad544..5ea151f6ea 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -33,209 +33,175 @@ if (empty($lang) || !is_array($lang)) // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine /** -* MODDERS PLEASE NOTE +* EXTENSION-DEVELOPERS PLEASE NOTE * -* You are able to put your permission sets into a separate file too by -* prefixing the new file with permissions_ and putting it into the acp -* language folder. -* -* An example of how the file could look like: -* -* <code> -* -* if (empty($lang) || !is_array($lang)) -* { -* $lang = array(); -* } -* -* // Adding new category -* $lang['permission_cat']['bugs'] = 'Bugs'; -* -* // Adding new permission set -* $lang['permission_type']['bug_'] = 'Bug Permissions'; -* -* // Adding the permissions -* $lang = array_merge($lang, array( -* 'acl_bug_view' => array('lang' => 'Can view bug reports', 'cat' => 'bugs'), -* 'acl_bug_post' => array('lang' => 'Can post bugs', 'cat' => 'post'), // Using a phpBB category here -* )); -* -* </code> +* You are able to put your permission sets into your extension. +* The permissions logic should be added via the 'core.permissions' event. +* You can easily add new permission categories, types and permissions, by +* simply merging them into the respective arrays. +* The respective language strings should be added into a language file, that +* start with 'permissions_', so they are automatically loaded within the ACP. */ -// Define categories and permission types $lang = array_merge($lang, array( - 'permission_cat' => array( - 'actions' => 'Actions', - 'content' => 'Content', - 'forums' => 'Forums', - 'misc' => 'Misc', - 'permissions' => 'Permissions', - 'pm' => 'Private messages', - 'polls' => 'Polls', - 'post' => 'Post', - 'post_actions' => 'Post actions', - 'posting' => 'Posting', - 'profile' => 'Profile', - 'settings' => 'Settings', - 'topic_actions' => 'Topic actions', - 'user_group' => 'Users & Groups', - ), - - // With defining 'global' here we are able to specify what is printed out if the permission is within the global scope. - 'permission_type' => array( - 'u_' => 'User permissions', - 'a_' => 'Admin permissions', - 'm_' => 'Moderator permissions', - 'f_' => 'Forum permissions', - 'global' => array( - 'm_' => 'Global moderator permissions', - ), - ), + 'ACL_CAT_ACTIONS' => 'Actions', + 'ACL_CAT_CONTENT' => 'Content', + 'ACL_CAT_FORUMS' => 'Forums', + 'ACL_CAT_MISC' => 'Misc', + 'ACL_CAT_PERMISSIONS' => 'Permissions', + 'ACL_CAT_PM' => 'Private messages', + 'ACL_CAT_POLLS' => 'Polls', + 'ACL_CAT_POST' => 'Post', + 'ACL_CAT_POST_ACTIONS' => 'Post actions', + 'ACL_CAT_POSTING' => 'Posting', + 'ACL_CAT_PROFILE' => 'Profile', + 'ACL_CAT_SETTINGS' => 'Settings', + 'ACL_CAT_TOPIC_ACTIONS' => 'Topic actions', + 'ACL_CAT_USER_GROUP' => 'Users & Groups', )); // User Permissions $lang = array_merge($lang, array( - 'acl_u_viewprofile' => array('lang' => 'Can view profiles, memberlist and online list', 'cat' => 'profile'), - 'acl_u_chgname' => array('lang' => 'Can change username', 'cat' => 'profile'), - 'acl_u_chgpasswd' => array('lang' => 'Can change password', 'cat' => 'profile'), - 'acl_u_chgemail' => array('lang' => 'Can change email address', 'cat' => 'profile'), - 'acl_u_chgavatar' => array('lang' => 'Can change avatar', 'cat' => 'profile'), - 'acl_u_chggrp' => array('lang' => 'Can change default usergroup', 'cat' => 'profile'), - 'acl_u_chgprofileinfo' => array('lang' => 'Can change profile field information', 'cat' => 'profile'), - - 'acl_u_attach' => array('lang' => 'Can attach files', 'cat' => 'post'), - 'acl_u_download' => array('lang' => 'Can download files', 'cat' => 'post'), - 'acl_u_savedrafts' => array('lang' => 'Can save drafts', 'cat' => 'post'), - 'acl_u_chgcensors' => array('lang' => 'Can disable word censors', 'cat' => 'post'), - 'acl_u_sig' => array('lang' => 'Can use signature', 'cat' => 'post'), - - 'acl_u_sendpm' => array('lang' => 'Can send private messages', 'cat' => 'pm'), - 'acl_u_masspm' => array('lang' => 'Can send messages to multiple users', 'cat' => 'pm'), - 'acl_u_masspm_group'=> array('lang' => 'Can send messages to groups', 'cat' => 'pm'), - 'acl_u_readpm' => array('lang' => 'Can read private messages', 'cat' => 'pm'), - 'acl_u_pm_edit' => array('lang' => 'Can edit own private messages', 'cat' => 'pm'), - 'acl_u_pm_delete' => array('lang' => 'Can remove private messages from own folder', 'cat' => 'pm'), - 'acl_u_pm_forward' => array('lang' => 'Can forward private messages', 'cat' => 'pm'), - 'acl_u_pm_emailpm' => array('lang' => 'Can email private messages', 'cat' => 'pm'), - 'acl_u_pm_printpm' => array('lang' => 'Can print private messages', 'cat' => 'pm'), - 'acl_u_pm_attach' => array('lang' => 'Can attach files in private messages', 'cat' => 'pm'), - 'acl_u_pm_download' => array('lang' => 'Can download files in private messages', 'cat' => 'pm'), - 'acl_u_pm_bbcode' => array('lang' => 'Can use BBCode in private messages', 'cat' => 'pm'), - 'acl_u_pm_smilies' => array('lang' => 'Can use smilies in private messages', 'cat' => 'pm'), - 'acl_u_pm_img' => array('lang' => 'Can use [img] BBCode tag in private messages', 'cat' => 'pm'), - 'acl_u_pm_flash' => array('lang' => 'Can use [flash] BBCode tag in private messages', 'cat' => 'pm'), - - 'acl_u_sendemail' => array('lang' => 'Can send emails', 'cat' => 'misc'), - 'acl_u_sendim' => array('lang' => 'Can send instant messages', 'cat' => 'misc'), - 'acl_u_ignoreflood' => array('lang' => 'Can ignore flood limit', 'cat' => 'misc'), - 'acl_u_hideonline' => array('lang' => 'Can hide online status', 'cat' => 'misc'), - 'acl_u_viewonline' => array('lang' => 'Can view hidden online users', 'cat' => 'misc'), - 'acl_u_search' => array('lang' => 'Can search board', 'cat' => 'misc'), + 'ACL_U_VIEWPROFILE' => 'Can view profiles, memberlist and online list', + 'ACL_U_CHGNAME' => 'Can change username', + 'ACL_U_CHGPASSWD' => 'Can change password', + 'ACL_U_CHGEMAIL' => 'Can change email address', + 'ACL_U_CHGAVATAR' => 'Can change avatar', + 'ACL_U_CHGGRP' => 'Can change default usergroup', + 'ACL_U_CHGPROFILEINFO' => 'Can change profile field information', + + 'ACL_U_ATTACH' => 'Can attach files', + 'ACL_U_DOWNLOAD' => 'Can download files', + 'ACL_U_SAVEDRAFTS' => 'Can save drafts', + 'ACL_U_CHGCENSORS' => 'Can disable word censors', + 'ACL_U_SIG' => 'Can use signature', + + 'ACL_U_SENDPM' => 'Can send private messages', + 'ACL_U_MASSPM' => 'Can send messages to multiple users', + 'ACL_U_MASSPM_GROUP'=> 'Can send messages to groups', + 'ACL_U_READPM' => 'Can read private messages', + 'ACL_U_PM_EDIT' => 'Can edit own private messages', + 'ACL_U_PM_DELETE' => 'Can remove private messages from own folder', + 'ACL_U_PM_FORWARD' => 'Can forward private messages', + 'ACL_U_PM_EMAILPM' => 'Can email private messages', + 'ACL_U_PM_PRINTPM' => 'Can print private messages', + 'ACL_U_PM_ATTACH' => 'Can attach files in private messages', + 'ACL_U_PM_DOWNLOAD' => 'Can download files in private messages', + 'ACL_U_PM_BBCODE' => 'Can use BBCode in private messages', + 'ACL_U_PM_SMILIES' => 'Can use smilies in private messages', + 'ACL_U_PM_IMG' => 'Can use [img] BBCode tag in private messages', + 'ACL_U_PM_FLASH' => 'Can use [flash] BBCode tag in private messages', + + 'ACL_U_SENDEMAIL' => 'Can send emails', + 'ACL_U_SENDIM' => 'Can send instant messages', + 'ACL_U_IGNOREFLOOD' => 'Can ignore flood limit', + 'ACL_U_HIDEONLINE' => 'Can hide online status', + 'ACL_U_VIEWONLINE' => 'Can view hidden online users', + 'ACL_U_SEARCH' => 'Can search board', )); // Forum Permissions $lang = array_merge($lang, array( - 'acl_f_list' => array('lang' => 'Can see forum', 'cat' => 'actions'), - 'acl_f_read' => array('lang' => 'Can read forum', 'cat' => 'actions'), - 'acl_f_search' => array('lang' => 'Can search the forum', 'cat' => 'actions'), - 'acl_f_subscribe' => array('lang' => 'Can subscribe forum', 'cat' => 'actions'), - 'acl_f_print' => array('lang' => 'Can print topics', 'cat' => 'actions'), - 'acl_f_email' => array('lang' => 'Can email topics', 'cat' => 'actions'), - 'acl_f_bump' => array('lang' => 'Can bump topics', 'cat' => 'actions'), - 'acl_f_user_lock' => array('lang' => 'Can lock own topics', 'cat' => 'actions'), - 'acl_f_download' => array('lang' => 'Can download files', 'cat' => 'actions'), - 'acl_f_report' => array('lang' => 'Can report posts', 'cat' => 'actions'), - - 'acl_f_post' => array('lang' => 'Can start new topics', 'cat' => 'post'), - 'acl_f_sticky' => array('lang' => 'Can post stickies', 'cat' => 'post'), - 'acl_f_announce' => array('lang' => 'Can post announcements', 'cat' => 'post'), - 'acl_f_reply' => array('lang' => 'Can reply to topics', 'cat' => 'post'), - 'acl_f_edit' => array('lang' => 'Can edit own posts', 'cat' => 'post'), - 'acl_f_delete' => array('lang' => 'Can 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'), - - 'acl_f_attach' => array('lang' => 'Can attach files', 'cat' => 'content'), - 'acl_f_icons' => array('lang' => 'Can use topic/post icons', 'cat' => 'content'), - 'acl_f_bbcode' => array('lang' => 'Can use BBCode', 'cat' => 'content'), - 'acl_f_flash' => array('lang' => 'Can use [flash] BBCode tag', 'cat' => 'content'), - 'acl_f_img' => array('lang' => 'Can use [img] BBCode tag', 'cat' => 'content'), - 'acl_f_sigs' => array('lang' => 'Can use signatures', 'cat' => 'content'), - 'acl_f_smilies' => array('lang' => 'Can use smilies', 'cat' => 'content'), - - 'acl_f_poll' => array('lang' => 'Can create polls', 'cat' => 'polls'), - 'acl_f_vote' => array('lang' => 'Can vote in polls', 'cat' => 'polls'), - 'acl_f_votechg' => array('lang' => 'Can change existing vote', 'cat' => 'polls'), + 'ACL_F_LIST' => 'Can see forum', + 'ACL_F_READ' => 'Can read forum', + 'ACL_F_SEARCH' => 'Can search the forum', + 'ACL_F_SUBSCRIBE' => 'Can subscribe forum', + 'ACL_F_PRINT' => 'Can print topics', + 'ACL_F_EMAIL' => 'Can email topics', + 'ACL_F_BUMP' => 'Can bump topics', + 'ACL_F_USER_LOCK' => 'Can lock own topics', + 'ACL_F_DOWNLOAD' => 'Can download files', + 'ACL_F_REPORT' => 'Can report posts', + + 'ACL_F_POST' => 'Can start new topics', + 'ACL_F_STICKY' => 'Can post stickies', + 'ACL_F_ANNOUNCE' => 'Can post announcements', + 'ACL_F_REPLY' => 'Can reply to topics', + 'ACL_F_EDIT' => 'Can edit own posts', + 'ACL_F_DELETE' => 'Can permanently delete own posts', + 'ACL_F_SOFTDELETE' => 'Can soft delete own posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>', + 'ACL_F_IGNOREFLOOD' => 'Can ignore flood limit', + 'ACL_F_POSTCOUNT' => 'Increment post counter<br /><em>Please note that this setting only affects new posts.</em>', + 'ACL_F_NOAPPROVE' => 'Can post without approval', + + 'ACL_F_ATTACH' => 'Can attach files', + 'ACL_F_ICONS' => 'Can use topic/post icons', + 'ACL_F_BBCODE' => 'Can use BBCode', + 'ACL_F_FLASH' => 'Can use [flash] BBCode tag', + 'ACL_F_IMG' => 'Can use [img] BBCode tag', + 'ACL_F_SIGS' => 'Can use signatures', + 'ACL_F_SMILIES' => 'Can use smilies', + + 'ACL_F_POLL' => 'Can create polls', + 'ACL_F_VOTE' => 'Can vote in polls', + 'ACL_F_VOTECHG' => 'Can change existing vote', )); // Moderator Permissions $lang = array_merge($lang, array( - 'acl_m_edit' => array('lang' => 'Can edit posts', 'cat' => 'post_actions'), - 'acl_m_delete' => array('lang' => 'Can 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'), - - 'acl_m_move' => array('lang' => 'Can move topics', 'cat' => 'topic_actions'), - 'acl_m_lock' => array('lang' => 'Can lock topics', 'cat' => 'topic_actions'), - 'acl_m_split' => array('lang' => 'Can split topics', 'cat' => 'topic_actions'), - 'acl_m_merge' => array('lang' => 'Can merge topics', 'cat' => 'topic_actions'), - - 'acl_m_info' => array('lang' => 'Can view post details', 'cat' => 'misc'), - 'acl_m_warn' => array('lang' => 'Can issue warnings<br /><em>This setting is only assigned globally. It is not forum based.</em>', 'cat' => 'misc'), // This moderator setting is only global (and not local) - 'acl_m_ban' => array('lang' => 'Can manage bans<br /><em>This setting is only assigned globally. It is not forum based.</em>', 'cat' => 'misc'), // This moderator setting is only global (and not local) + 'ACL_M_EDIT' => 'Can edit posts', + 'ACL_M_DELETE' => 'Can permanently delete posts', + 'ACL_M_SOFTDELETE' => 'Can soft delete posts<br /><em>Moderators, who have the approve posts permission, can restore soft deleted posts.</em>', + 'ACL_M_APPROVE' => 'Can approve posts', + 'ACL_M_REPORT' => 'Can close and delete reports', + 'ACL_M_CHGPOSTER' => 'Can change post author', + + 'ACL_M_MOVE' => 'Can move topics', + 'ACL_M_LOCK' => 'Can lock topics', + 'ACL_M_SPLIT' => 'Can split topics', + 'ACL_M_MERGE' => 'Can merge topics', + + 'ACL_M_INFO' => 'Can view post details', + 'ACL_M_WARN' => 'Can issue warnings<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local) + 'ACL_M_BAN' => 'Can manage bans<br /><em>This setting is only assigned globally. It is not forum based.</em>', // This moderator setting is only global (and not local) )); // Admin Permissions $lang = array_merge($lang, array( - 'acl_a_board' => array('lang' => 'Can alter board settings/check for updates', 'cat' => 'settings'), - 'acl_a_server' => array('lang' => 'Can alter server/communication settings', 'cat' => 'settings'), - 'acl_a_jabber' => array('lang' => 'Can alter Jabber settings', 'cat' => 'settings'), - 'acl_a_phpinfo' => array('lang' => 'Can view php settings', 'cat' => 'settings'), - - 'acl_a_forum' => array('lang' => 'Can manage forums', 'cat' => 'forums'), - 'acl_a_forumadd' => array('lang' => 'Can add new forums', 'cat' => 'forums'), - 'acl_a_forumdel' => array('lang' => 'Can delete forums', 'cat' => 'forums'), - 'acl_a_prune' => array('lang' => 'Can prune forums', 'cat' => 'forums'), - - 'acl_a_icons' => array('lang' => 'Can alter topic/post icons and smilies', 'cat' => 'posting'), - 'acl_a_words' => array('lang' => 'Can alter word censors', 'cat' => 'posting'), - 'acl_a_bbcode' => array('lang' => 'Can define BBCode tags', 'cat' => 'posting'), - 'acl_a_attach' => array('lang' => 'Can alter attachment related settings', 'cat' => 'posting'), - - 'acl_a_user' => array('lang' => 'Can manage users<br /><em>This also includes seeing the users browser agent within the viewonline list.</em>', 'cat' => 'user_group'), - 'acl_a_userdel' => array('lang' => 'Can delete/prune users', 'cat' => 'user_group'), - 'acl_a_group' => array('lang' => 'Can manage groups', 'cat' => 'user_group'), - 'acl_a_groupadd' => array('lang' => 'Can add new groups', 'cat' => 'user_group'), - 'acl_a_groupdel' => array('lang' => 'Can delete groups', 'cat' => 'user_group'), - 'acl_a_ranks' => array('lang' => 'Can manage ranks', 'cat' => 'user_group'), - 'acl_a_profile' => array('lang' => 'Can manage custom profile fields', 'cat' => 'user_group'), - 'acl_a_names' => array('lang' => 'Can manage disallowed names', 'cat' => 'user_group'), - 'acl_a_ban' => array('lang' => 'Can manage bans', 'cat' => 'user_group'), - - 'acl_a_viewauth' => array('lang' => 'Can view permission masks', 'cat' => 'permissions'), - 'acl_a_authgroups' => array('lang' => 'Can alter permissions for individual groups', 'cat' => 'permissions'), - 'acl_a_authusers' => array('lang' => 'Can alter permissions for individual users', 'cat' => 'permissions'), - 'acl_a_fauth' => array('lang' => 'Can alter forum permission class', 'cat' => 'permissions'), - 'acl_a_mauth' => array('lang' => 'Can alter moderator permission class', 'cat' => 'permissions'), - 'acl_a_aauth' => array('lang' => 'Can alter admin permission class', 'cat' => 'permissions'), - 'acl_a_uauth' => array('lang' => 'Can alter user permission class', 'cat' => 'permissions'), - 'acl_a_roles' => array('lang' => 'Can manage roles', 'cat' => 'permissions'), - 'acl_a_switchperm' => array('lang' => 'Can use others permissions', 'cat' => 'permissions'), - - 'acl_a_styles' => array('lang' => 'Can manage styles', 'cat' => 'misc'), - 'acl_a_extensions' => array('lang' => 'Can manage extensions', 'cat' => 'misc'), - 'acl_a_viewlogs' => array('lang' => 'Can view logs', 'cat' => 'misc'), - 'acl_a_clearlogs' => array('lang' => 'Can clear logs', 'cat' => 'misc'), - 'acl_a_modules' => array('lang' => 'Can manage modules', 'cat' => 'misc'), - 'acl_a_language' => array('lang' => 'Can manage language packs', 'cat' => 'misc'), - 'acl_a_email' => array('lang' => 'Can send mass email', 'cat' => 'misc'), - 'acl_a_bots' => array('lang' => 'Can manage bots', 'cat' => 'misc'), - 'acl_a_reasons' => array('lang' => 'Can manage report/denial reasons', 'cat' => 'misc'), - 'acl_a_backup' => array('lang' => 'Can backup/restore database', 'cat' => 'misc'), - 'acl_a_search' => array('lang' => 'Can manage search backends and settings', 'cat' => 'misc'), + 'ACL_A_BOARD' => 'Can alter board settings/check for updates', + 'ACL_A_SERVER' => 'Can alter server/communication settings', + 'ACL_A_JABBER' => 'Can alter Jabber settings', + 'ACL_A_PHPINFO' => 'Can view php settings', + + 'ACL_A_FORUM' => 'Can manage forums', + 'ACL_A_FORUMADD' => 'Can add new forums', + 'ACL_A_FORUMDEL' => 'Can delete forums', + 'ACL_A_PRUNE' => 'Can prune forums', + + 'ACL_A_ICONS' => 'Can alter topic/post icons and smilies', + 'ACL_A_WORDS' => 'Can alter word censors', + 'ACL_A_BBCODE' => 'Can define BBCode tags', + 'ACL_A_ATTACH' => 'Can alter attachment related settings', + + 'ACL_A_USER' => 'Can manage users<br /><em>This also includes seeing the users browser agent within the viewonline list.</em>', + 'ACL_A_USERDEL' => 'Can delete/prune users', + 'ACL_A_GROUP' => 'Can manage groups', + 'ACL_A_GROUPADD' => 'Can add new groups', + 'ACL_A_GROUPDEL' => 'Can delete groups', + 'ACL_A_RANKS' => 'Can manage ranks', + 'ACL_A_PROFILE' => 'Can manage custom profile fields', + 'ACL_A_NAMES' => 'Can manage disallowed names', + 'ACL_A_BAN' => 'Can manage bans', + + 'ACL_A_VIEWAUTH' => 'Can view permission masks', + 'ACL_A_AUTHGROUPS' => 'Can alter permissions for individual groups', + 'ACL_A_AUTHUSERS' => 'Can alter permissions for individual users', + 'ACL_A_FAUTH' => 'Can alter forum permission class', + 'ACL_A_MAUTH' => 'Can alter moderator permission class', + 'ACL_A_AAUTH' => 'Can alter admin permission class', + 'ACL_A_UAUTH' => 'Can alter user permission class', + 'ACL_A_ROLES' => 'Can manage roles', + 'ACL_A_SWITCHPERM' => 'Can use others permissions', + + 'ACL_A_STYLES' => 'Can manage styles', + 'ACL_A_EXTENSIONS' => 'Can manage extensions', + 'ACL_A_VIEWLOGS' => 'Can view logs', + 'ACL_A_CLEARLOGS' => 'Can clear logs', + 'ACL_A_MODULES' => 'Can manage modules', + 'ACL_A_LANGUAGE' => 'Can manage language packs', + 'ACL_A_EMAIL' => 'Can send mass email', + 'ACL_A_BOTS' => 'Can manage bots', + 'ACL_A_REASONS' => 'Can manage report/denial reasons', + 'ACL_A_BACKUP' => 'Can backup/restore database', + 'ACL_A_SEARCH' => 'Can manage search backends and settings', )); diff --git a/phpBB/language/en/email/installed.txt b/phpBB/language/en/email/installed.txt index 9ec93484e1..8f63d07635 100644 --- a/phpBB/language/en/email/installed.txt +++ b/phpBB/language/en/email/installed.txt @@ -12,7 +12,7 @@ Username: {USERNAME} Board URL: {U_BOARD} ---------------------------- -Useful information regarding the phpBB software can be found in the docs folder of your installation and on phpBB.com's support page - http://www.phpbb.com/support/ +Useful information regarding the phpBB software can be found in the docs folder of your installation and on phpBB.com's support page - https://www.phpbb.com/support/ In order to keep your board safe and secure, we highly recommended keeping current with software releases. For your convenience, a mailing list is available at the page referenced above. diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index 68dc05f992..94e6622685 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -332,7 +332,7 @@ $help = array( ), array( 0 => 'Why isn’t X feature available?', - 1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added, or you want to report a bug, please visit the phpBB <a href="http://area51.phpbb.com/">Area51</a> website, where you will find resources to do so.' + 1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added please visit the <a href="https://www.phpbb.com/ideas/">phpBB Ideas Centre</a>, where you can upvote existing ideas or suggest new features.' ), array( 0 => 'Who do I contact about abusive and/or legal matters related to this board?', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index be45047861..03c9562983 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -374,7 +374,7 @@ $lang = array_merge($lang, array( // Updater $lang = array_merge($lang, array( - 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="%2$s">Send statistics</a> module in your ACP.', + 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.', 'ARCHIVE_FILE' => 'Source file within archive', 'BACK' => 'Back', @@ -398,7 +398,7 @@ $lang = array_merge($lang, array( 'DATABASE_TYPE' => 'Database type', 'DATABASE_UPDATE_COMPLETE' => 'Database updater has completed!', - 'DATABASE_UPDATE_CONTINUE' => 'Continue database update.', + 'DATABASE_UPDATE_CONTINUE' => 'Continue database update', 'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.', 'DATABASE_UPDATE_NOT_COMPLETED' => 'The database update has not yet completed.', 'DELETE_USER_REMOVE' => 'Delete user and remove posts', @@ -419,8 +419,9 @@ $lang = array_merge($lang, array( 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', - 'ERROR' => 'Error', 'EDIT_USERNAME' => 'Edit username', + 'ERROR' => 'Error', + 'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="%2$s">Send statistics</a> module in your ACP.', 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', @@ -570,6 +571,7 @@ $lang = array_merge($lang, array( 'UPLOAD_METHOD' => 'Upload method', 'UPDATE_DB_SUCCESS' => 'Database update was successful.', + 'UPDATE_FILE_SUCCESS' => 'File update was successful.', 'USER_ACTIVE' => 'Active user', 'USER_INACTIVE' => 'Inactive user', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 46136dbdd4..26f920fe5a 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -561,17 +561,8 @@ switch ($mode) if ($member['user_sig']) { - $member['user_sig'] = censor_text($member['user_sig']); - - if ($member['user_sig_bbcode_bitfield']) - { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); - $bbcode = new bbcode(); - $bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']); - } - - $member['user_sig'] = bbcode_nl2br($member['user_sig']); - $member['user_sig'] = smiley_text($member['user_sig']); + $parse_flags = ($member['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $member['user_sig'] = generate_text_for_display($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield'], $parse_flags, true); } $poster_avatar = phpbb_get_user_avatar($member); diff --git a/phpBB/includes/auth/auth.php b/phpBB/phpbb/auth/auth.php index 279959974d..279959974d 100644 --- a/phpBB/includes/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php diff --git a/phpBB/includes/auth/index.htm b/phpBB/phpbb/auth/index.htm index ee1f723a7d..ee1f723a7d 100644 --- a/phpBB/includes/auth/index.htm +++ b/phpBB/phpbb/auth/index.htm diff --git a/phpBB/includes/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php index 2e80436f78..2e80436f78 100644 --- a/phpBB/includes/auth/provider/apache.php +++ b/phpBB/phpbb/auth/provider/apache.php diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php index 7eaf8bb2d3..7eaf8bb2d3 100644 --- a/phpBB/includes/auth/provider/base.php +++ b/phpBB/phpbb/auth/provider/base.php diff --git a/phpBB/includes/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php index 0934c56d9b..0934c56d9b 100644 --- a/phpBB/includes/auth/provider/db.php +++ b/phpBB/phpbb/auth/provider/db.php diff --git a/phpBB/includes/auth/provider/index.htm b/phpBB/phpbb/auth/provider/index.htm index ee1f723a7d..ee1f723a7d 100644 --- a/phpBB/includes/auth/provider/index.htm +++ b/phpBB/phpbb/auth/provider/index.htm diff --git a/phpBB/includes/auth/provider/interface.php b/phpBB/phpbb/auth/provider/interface.php index 47043bc107..47043bc107 100644 --- a/phpBB/includes/auth/provider/interface.php +++ b/phpBB/phpbb/auth/provider/interface.php diff --git a/phpBB/includes/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php index 0196529408..0196529408 100644 --- a/phpBB/includes/auth/provider/ldap.php +++ b/phpBB/phpbb/auth/provider/ldap.php diff --git a/phpBB/includes/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index 29c58d4e62..29c58d4e62 100644 --- a/phpBB/includes/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php diff --git a/phpBB/includes/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php index d559da1c0d..d559da1c0d 100644 --- a/phpBB/includes/avatar/driver/gravatar.php +++ b/phpBB/phpbb/avatar/driver/gravatar.php diff --git a/phpBB/includes/avatar/driver/interface.php b/phpBB/phpbb/avatar/driver/interface.php index 3d62969aef..3d62969aef 100644 --- a/phpBB/includes/avatar/driver/interface.php +++ b/phpBB/phpbb/avatar/driver/interface.php diff --git a/phpBB/includes/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index f4bcd4ce74..f4bcd4ce74 100644 --- a/phpBB/includes/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php diff --git a/phpBB/includes/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php index 7da58107a1..d629a490fd 100644 --- a/phpBB/includes/avatar/driver/remote.php +++ b/phpBB/phpbb/avatar/driver/remote.php @@ -93,7 +93,7 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver // Make sure getimagesize works... if (function_exists('getimagesize')) { - if (($width <= 0 || $height <= 0) && (($image_data = getimagesize($url)) === false)) + if (($width <= 0 || $height <= 0) && (($image_data = @getimagesize($url)) === false)) { $error[] = 'UNABLE_GET_IMAGE_SIZE'; return false; diff --git a/phpBB/includes/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index 685ac4f349..685ac4f349 100644 --- a/phpBB/includes/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php 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..944dfd6541 100644 --- a/phpBB/includes/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -205,28 +205,34 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base function purge() { // Purge all phpbb cache files - $dir = @opendir($this->cache_dir); - - if (!$dir) + try + { + $iterator = new DirectoryIterator($this->cache_dir); + } + catch (Exception $e) { return; } - while (($entry = readdir($dir)) !== false) + foreach ($iterator as $fileInfo) { - if (strpos($entry, 'container_') !== 0 && - strpos($entry, 'url_matcher') !== 0 && - strpos($entry, 'sql_') !== 0 && - strpos($entry, 'data_') !== 0 && - strpos($entry, 'ctpl_') !== 0 && - strpos($entry, 'tpl_') !== 0) + if ($fileInfo->isDot()) { continue; } - - $this->remove_file($this->cache_dir . $entry); + $filename = $fileInfo->getFilename(); + if ($fileInfo->isDir()) + { + $this->remove_dir($fileInfo->getPathname()); + } + elseif (strpos($filename, 'container_') === 0 || + strpos($filename, 'url_matcher') === 0 || + strpos($filename, 'sql_') === 0 || + strpos($filename, 'data_') === 0) + { + $this->remove_file($fileInfo->getPathname()); + } } - closedir($dir); unset($this->vars); unset($this->var_expires); @@ -242,6 +248,44 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base } /** + * Remove directory + * + * @param string $dir Directory to remove + * + * @return null + */ + protected function remove_dir($dir) + { + try + { + $iterator = new DirectoryIterator($dir); + } + catch (Exception $e) + { + return; + } + + foreach ($iterator as $fileInfo) + { + if ($fileInfo->isDot()) + { + continue; + } + + if ($fileInfo->isDir()) + { + $this->remove_dir($fileInfo->getPathname()); + } + else + { + $this->remove_file($fileInfo->getPathname()); + } + } + + @rmdir($dir); + } + + /** * Destroy cache data */ function destroy($var_name, $table = '') 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/includes/content_visibility.php b/phpBB/phpbb/content_visibility.php index 4ad5f6793e..fb8ece0e8c 100644 --- a/phpBB/includes/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -360,6 +360,11 @@ class phpbb_content_visibility // Sync the first/last topic information if needed if (!$is_starter && $is_latest) { + if (!function_exists('update_post_information')) + { + include($this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext); + } + // update_post_information can only update the last post info ... if ($topic_id) { diff --git a/phpBB/includes/controller/exception.php b/phpBB/phpbb/controller/exception.php index faa8b6b584..faa8b6b584 100644 --- a/phpBB/includes/controller/exception.php +++ b/phpBB/phpbb/controller/exception.php diff --git a/phpBB/includes/controller/helper.php b/phpBB/phpbb/controller/helper.php index 74410ddfd1..74410ddfd1 100644 --- a/phpBB/includes/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php diff --git a/phpBB/includes/controller/provider.php b/phpBB/phpbb/controller/provider.php index b2a5b9f6b2..b2a5b9f6b2 100644 --- a/phpBB/includes/controller/provider.php +++ b/phpBB/phpbb/controller/provider.php diff --git a/phpBB/includes/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index 95dfc8da8e..d772507261 100644 --- a/phpBB/includes/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -38,23 +38,23 @@ class phpbb_controller_resolver implements ControllerResolverInterface protected $container; /** - * phpbb_style object - * @var phpbb_style + * phpbb_template object + * @var phpbb_template */ - protected $style; + protected $template; /** * Construct method * * @param phpbb_user $user User Object * @param ContainerInterface $container ContainerInterface object - * @param phpbb_style $style + * @param phpbb_template $template */ - public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null) + public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_template $template = null) { $this->user = $user; $this->container = $container; - $this->style = $style; + $this->template = $template; } /** @@ -96,13 +96,13 @@ class phpbb_controller_resolver implements ControllerResolverInterface $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') + if (!is_null($this->template) && 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')); + $this->template->set_style(array($controller_style_dir, 'styles')); } } 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 08c966c07a..08c966c07a 100644 --- a/phpBB/includes/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php diff --git a/phpBB/includes/db/driver/firebird.php b/phpBB/phpbb/db/driver/firebird.php index 787c28b812..787c28b812 100644 --- a/phpBB/includes/db/driver/firebird.php +++ b/phpBB/phpbb/db/driver/firebird.php diff --git a/phpBB/includes/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php index 89c2c2351b..89c2c2351b 100644 --- a/phpBB/includes/db/driver/mssql.php +++ b/phpBB/phpbb/db/driver/mssql.php diff --git a/phpBB/includes/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php index 56c111c871..56c111c871 100644 --- a/phpBB/includes/db/driver/mssql_base.php +++ b/phpBB/phpbb/db/driver/mssql_base.php diff --git a/phpBB/includes/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php index a1d1a5d5dd..a1d1a5d5dd 100644 --- a/phpBB/includes/db/driver/mssql_odbc.php +++ b/phpBB/phpbb/db/driver/mssql_odbc.php diff --git a/phpBB/includes/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index 28fc88298a..28fc88298a 100644 --- a/phpBB/includes/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php diff --git a/phpBB/includes/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php index f3744ac09d..f3744ac09d 100644 --- a/phpBB/includes/db/driver/mysql.php +++ b/phpBB/phpbb/db/driver/mysql.php diff --git a/phpBB/includes/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php index ba44ea61aa..ba44ea61aa 100644 --- a/phpBB/includes/db/driver/mysql_base.php +++ b/phpBB/phpbb/db/driver/mysql_base.php diff --git a/phpBB/includes/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php index 0f7a73ee6e..0f7a73ee6e 100644 --- a/phpBB/includes/db/driver/mysqli.php +++ b/phpBB/phpbb/db/driver/mysqli.php diff --git a/phpBB/includes/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php index e21e07055d..e21e07055d 100644 --- a/phpBB/includes/db/driver/oracle.php +++ b/phpBB/phpbb/db/driver/oracle.php diff --git a/phpBB/includes/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index 14854d179d..14854d179d 100644 --- a/phpBB/includes/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php diff --git a/phpBB/includes/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php index 7188f0daa2..7188f0daa2 100644 --- a/phpBB/includes/db/driver/sqlite.php +++ b/phpBB/phpbb/db/driver/sqlite.php diff --git a/phpBB/includes/db/migration/data/30x/3_0_1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1.php index c996a0138a..c5b1681d96 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_1.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.1', '>='); } static public function depends_on() 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..640fcbc16f 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_10.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10', '>='); + return phpbb_version_compare($this->config['version'], '3.0.10', '>='); } static public function depends_on() 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..e0aca09c3a 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.10-RC1', '>='); } static public function depends_on() @@ -24,7 +24,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration return array( array('config.add', array('email_max_chunk_size', 50)), - array('config.update', array('version', '3.0.10-rc1')), + array('config.update', array('version', '3.0.10-RC1')), ); } } 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..394e030acf 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10-rc2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.10-RC2', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.10-rc2')), + array('config.update', array('version', '3.0.10-RC2')), ); } } 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..92900e3aed 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.10-rc3', '>='); + return phpbb_version_compare($this->config['version'], '3.0.10-RC3', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.10-rc3')), + array('config.update', array('version', '3.0.10-RC3')), ); } } 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..3be03cec40 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_11.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_11.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_11 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.11', '>='); + return phpbb_version_compare($this->config['version'], '3.0.11', '>='); } static public function depends_on() 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..f7b0247fdb 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.11-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.11-RC1', '>='); } static public function depends_on() @@ -25,7 +25,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'cleanup_deactivated_styles'))), array('custom', array(array(&$this, 'delete_orphan_private_messages'))), - array('config.update', array('version', '3.0.11-rc1')), + array('config.update', array('version', '3.0.11-RC1')), ); } 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..204aa314ac 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.11-rc2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.11-RC2', '>='); } static public function depends_on() @@ -44,7 +44,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.11-rc2')), + array('config.update', array('version', '3.0.11-RC2')), ); } } 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..31d37afa48 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 @@ -13,7 +13,7 @@ class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.12-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.12-RC1', '>='); } static public function depends_on() @@ -28,7 +28,7 @@ class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'update_bots'))), array('custom', array(array(&$this, 'disable_bots_from_receiving_pms'))), - array('config.update', array('version', '3.0.12-rc1')), + array('config.update', array('version', '3.0.12-RC1')), ); } @@ -108,7 +108,7 @@ class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration WHERE user_id = $bot_user_id"; $this->sql_query($sql); - user_delete('remove', $bot_user_id); + user_delete('retain', $bot_user_id); } else { 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..984b8fb37e 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_1_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.1-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.1-RC1', '>='); } public function update_schema() @@ -74,7 +74,7 @@ class phpbb_db_migration_data_30x_3_0_1_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'fix_unset_last_view_time'))), array('custom', array(array(&$this, 'reset_smiley_size'))), - array('config.update', array('version', '3.0.1-rc1')), + array('config.update', array('version', '3.0.1-RC1')), ); } 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..6e11e5a145 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_2.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.2', '>='); } static public function depends_on() 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..9a25628f25 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.2-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.2-RC1', '>='); } static public function depends_on() @@ -26,7 +26,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration array('config.add', array('check_attachment_content', '1')), array('config.add', array('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title')), - array('config.update', array('version', '3.0.2-rc1')), + array('config.update', array('version', '3.0.2-RC1')), ); } } 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..6c37d6701b 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.2-rc2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.2-RC2', '>='); } static public function depends_on() @@ -74,7 +74,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.2-rc2')), + array('config.update', array('version', '3.0.2-RC2')), ); } } 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..11fd2a2e80 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_3.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.3', '>='); + return phpbb_version_compare($this->config['version'], '3.0.3', '>='); } static public function depends_on() 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..cbeb00499a 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.3-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.3-RC1', '>='); } static public function depends_on() @@ -60,7 +60,7 @@ class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration array('permission.add', array('u_masspm_group', true, 'u_masspm')), array('custom', array(array(&$this, 'correct_acp_email_permissions'))), - array('config.update', array('version', '3.0.3-rc1')), + array('config.update', array('version', '3.0.3-RC1')), ); } 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..4375a96dac 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_4.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_4.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_4 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.4', '>='); + return phpbb_version_compare($this->config['version'], '3.0.4', '>='); } static public function depends_on() 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..73334dcc6f 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.4-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.4-RC1', '>='); } static public function depends_on() @@ -76,7 +76,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration return array( array('custom', array(array(&$this, 'update_custom_profile_fields'))), - array('config.update', array('version', '3.0.4-rc1')), + array('config.update', array('version', '3.0.4-RC1')), ); } 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..2700274f35 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_5.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_5.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_5 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.5', '>='); + return phpbb_version_compare($this->config['version'], '3.0.5', '>='); } static public function depends_on() 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..90c6b3b46a 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.5-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>='); } static public function depends_on() 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..2d1e5cfed8 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.5-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>='); } static public function depends_on() @@ -36,7 +36,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.5-rc1')), + array('config.update', array('version', '3.0.5-RC1')), ); } } 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..1877b0c5a1 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_6.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6', '>='); } static public function depends_on() 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..3e2a9544c7 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6-RC1', '>='); } static public function depends_on() @@ -185,7 +185,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'add_newly_registered_group'))), array('custom', array(array(&$this, 'set_user_options_default'))), - array('config.update', array('version', '3.0.6-rc1')), + array('config.update', array('version', '3.0.6-RC1')), ); } 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..439e25b100 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-rc2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6-RC2', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.6-rc2')), + array('config.update', array('version', '3.0.6-RC2')), ); } } 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..77b62d7fc7 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-rc3', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6-RC3', '>='); } static public function depends_on() @@ -24,7 +24,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration return array( array('custom', array(array(&$this, 'update_cp_fields'))), - array('config.update', array('version', '3.0.6-rc3')), + array('config.update', array('version', '3.0.6-RC3')), ); } 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..61a31d09e6 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.6-rc4', '>='); + return phpbb_version_compare($this->config['version'], '3.0.6-RC4', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.6-rc4')), + array('config.update', array('version', '3.0.6-RC4')), ); } } 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..3eb1caddbc 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_7.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7', '>='); + return phpbb_version_compare($this->config['version'], '3.0.7', '>='); } static public function depends_on() 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..c7b5c584ac 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7_pl1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7-pl1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.7-pl1', '>='); } static public function depends_on() 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..e0fd313834 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.7-RC1', '>='); } static public function depends_on() @@ -62,7 +62,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration array('config.add', array('feed_topics_active', $this->config['feed_overall_topics'])), array('custom', array(array(&$this, 'delete_text_templates'))), - array('config.update', array('version', '3.0.7-rc1')), + array('config.update', array('version', '3.0.7-RC1')), ); } 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..f4f3327385 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.7-rc2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.7-RC2', '>='); } static public function depends_on() @@ -24,7 +24,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration return array( array('custom', array(array(&$this, 'update_email_hash'))), - array('config.update', array('version', '3.0.7-rc2')), + array('config.update', array('version', '3.0.7-RC2')), ); } 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..77771a9acd 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_8.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_8.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_8 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.8', '>='); + return phpbb_version_compare($this->config['version'], '3.0.8', '>='); } static public function depends_on() 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..c534cabb6c 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.8-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.8-RC1', '>='); } static public function depends_on() @@ -38,7 +38,7 @@ class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration array('config.update_if_equals', array(600, 'queue_interval', 60)), array('config.update_if_equals', array(50, 'email_package_size', 20)), - array('config.update', array('version', '3.0.8-rc1')), + array('config.update', array('version', '3.0.8-RC1')), ); } 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..6a38793269 100644 --- a/phpBB/includes/db/migration/data/30x/3_0_9.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9.php @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9', '>='); } static public function depends_on() 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 4c345b429b..81c67550bd 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-rc1', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9-RC1', '>='); } static public function depends_on() @@ -74,7 +74,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'update_file_extension_group_names'))), array('custom', array(array(&$this, 'fix_firebird_qa_captcha'))), - array('config.update', array('version', '3.0.9-rc1')), + array('config.update', array('version', '3.0.9-RC1')), ); } 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..1531f408b7 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-rc2', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9-RC2', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.9-rc2')), + array('config.update', array('version', '3.0.9-RC2')), ); } } 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..851680b093 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-rc3', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9-RC3', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.9-rc3')), + array('config.update', array('version', '3.0.9-RC3')), ); } } 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..879538c341 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 @@ -11,7 +11,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration { public function effectively_installed() { - return version_compare($this->config['version'], '3.0.9-rc4', '>='); + return phpbb_version_compare($this->config['version'], '3.0.9-RC4', '>='); } static public function depends_on() @@ -22,7 +22,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('version', '3.0.9-rc4')), + array('config.update', array('version', '3.0.9-RC4')), ); } } diff --git a/phpBB/includes/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php index f324b8880d..f324b8880d 100644 --- a/phpBB/includes/db/migration/data/30x/local_url_bbcode.php +++ b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php diff --git a/phpBB/includes/db/migration/data/310/avatars.php b/phpBB/phpbb/db/migration/data/310/avatars.php index 79547337f7..79547337f7 100644 --- a/phpBB/includes/db/migration/data/310/avatars.php +++ b/phpBB/phpbb/db/migration/data/310/avatars.php diff --git a/phpBB/includes/db/migration/data/310/boardindex.php b/phpBB/phpbb/db/migration/data/310/boardindex.php index 965e32c15c..965e32c15c 100644 --- a/phpBB/includes/db/migration/data/310/boardindex.php +++ b/phpBB/phpbb/db/migration/data/310/boardindex.php diff --git a/phpBB/includes/db/migration/data/310/config_db_text.php b/phpBB/phpbb/db/migration/data/310/config_db_text.php index 89f211adda..89f211adda 100644 --- a/phpBB/includes/db/migration/data/310/config_db_text.php +++ b/phpBB/phpbb/db/migration/data/310/config_db_text.php diff --git a/phpBB/includes/db/migration/data/310/dev.php b/phpBB/phpbb/db/migration/data/310/dev.php index 13b36bbf30..0fc2950987 100644 --- a/phpBB/includes/db/migration/data/310/dev.php +++ b/phpBB/phpbb/db/migration/data/310/dev.php @@ -82,7 +82,10 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration public function update_data() { return array( - array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), + array('if', array( + (strpos('phpbb_search_', $this->config['search_type']) !== 0), + array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), + )), array('config.add', array('fulltext_postgres_ts_name', 'simple')), array('config.add', array('fulltext_postgres_min_word_len', 4)), diff --git a/phpBB/includes/db/migration/data/310/extensions.php b/phpBB/phpbb/db/migration/data/310/extensions.php index 6a9caa1cfc..6a9caa1cfc 100644 --- a/phpBB/includes/db/migration/data/310/extensions.php +++ b/phpBB/phpbb/db/migration/data/310/extensions.php diff --git a/phpBB/includes/db/migration/data/310/forgot_password.php b/phpBB/phpbb/db/migration/data/310/forgot_password.php index a553e51f35..a553e51f35 100644 --- a/phpBB/includes/db/migration/data/310/forgot_password.php +++ b/phpBB/phpbb/db/migration/data/310/forgot_password.php diff --git a/phpBB/includes/db/migration/data/310/jquery_update.php b/phpBB/phpbb/db/migration/data/310/jquery_update.php index dc49f74fcb..dc49f74fcb 100644 --- a/phpBB/includes/db/migration/data/310/jquery_update.php +++ b/phpBB/phpbb/db/migration/data/310/jquery_update.php diff --git a/phpBB/includes/db/migration/data/310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php index d994d7ec5f..d994d7ec5f 100644 --- a/phpBB/includes/db/migration/data/310/notification_options_reconvert.php +++ b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php diff --git a/phpBB/includes/db/migration/data/310/notifications.php b/phpBB/phpbb/db/migration/data/310/notifications.php index 17c939d95a..17c939d95a 100644 --- a/phpBB/includes/db/migration/data/310/notifications.php +++ b/phpBB/phpbb/db/migration/data/310/notifications.php diff --git a/phpBB/includes/db/migration/data/310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php index 27e63e10d0..27e63e10d0 100644 --- a/phpBB/includes/db/migration/data/310/notifications_schema_fix.php +++ b/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php diff --git a/phpBB/includes/db/migration/data/310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/310/reported_posts_display.php index 80a0a0e43f..80a0a0e43f 100644 --- a/phpBB/includes/db/migration/data/310/reported_posts_display.php +++ b/phpBB/phpbb/db/migration/data/310/reported_posts_display.php diff --git a/phpBB/includes/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php index e4fbb27bcb..02cd70059a 100644 --- a/phpBB/includes/db/migration/data/310/signature_module_auth.php +++ b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php @@ -17,7 +17,7 @@ class phpbb_db_migration_data_310_signature_module_auth extends phpbb_db_migrati AND module_basename = 'ucp_profile' AND module_mode = 'signature'"; $result = $this->db->sql_query($sql); - $module_auth = $this->db_sql_fetchfield('module_auth'); + $module_auth = $this->db->sql_fetchfield('module_auth'); $this->db->sql_freeresult($result); return $module_auth === 'acl_u_sig' || $module_auth === false; diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php b/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php new file mode 100644 index 0000000000..f80f55d19a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php @@ -0,0 +1,55 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* +*/ + +class phpbb_db_migration_data_310_softdelete_mcp_modules extends phpbb_db_migration +{ + public function effectively_installed() + { + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'mcp' + AND module_basename = 'mcp_queue' + AND module_mode = 'deleted_topics'"; + $result = $this->db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + return $module_id !== false; + } + + static public function depends_on() + { + return array( + 'phpbb_db_migration_data_310_dev', + 'phpbb_db_migration_data_310_softdelete_p2', + ); + } + + public function update_data() + { + return array( + array('module.add', array( + 'mcp', + 'MCP_QUEUE', + array( + 'module_basename' => 'mcp_queue', + 'modes' => array('deleted_topics'), + ), + )), + array('module.add', array( + 'mcp', + 'MCP_QUEUE', + array( + 'module_basename' => 'mcp_queue', + 'modes' => array('deleted_posts'), + ), + )), + ); + } +} diff --git a/phpBB/includes/db/migration/data/310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php index 84f8eebd4a..84f8eebd4a 100644 --- a/phpBB/includes/db/migration/data/310/softdelete_p1.php +++ b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php diff --git a/phpBB/includes/db/migration/data/310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php index 7320a2c2bf..7320a2c2bf 100644 --- a/phpBB/includes/db/migration/data/310/softdelete_p2.php +++ b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php diff --git a/phpBB/includes/db/migration/data/310/style_update_p1.php b/phpBB/phpbb/db/migration/data/310/style_update_p1.php index d43537559d..d43537559d 100644 --- a/phpBB/includes/db/migration/data/310/style_update_p1.php +++ b/phpBB/phpbb/db/migration/data/310/style_update_p1.php diff --git a/phpBB/includes/db/migration/data/310/style_update_p2.php b/phpBB/phpbb/db/migration/data/310/style_update_p2.php index 7b10518a66..7b10518a66 100644 --- a/phpBB/includes/db/migration/data/310/style_update_p2.php +++ b/phpBB/phpbb/db/migration/data/310/style_update_p2.php diff --git a/phpBB/includes/db/migration/data/310/teampage.php b/phpBB/phpbb/db/migration/data/310/teampage.php index 4e77da17b7..4e77da17b7 100644 --- a/phpBB/includes/db/migration/data/310/teampage.php +++ b/phpBB/phpbb/db/migration/data/310/teampage.php diff --git a/phpBB/includes/db/migration/data/310/timezone.php b/phpBB/phpbb/db/migration/data/310/timezone.php index 6e50cbe45f..6e50cbe45f 100644 --- a/phpBB/includes/db/migration/data/310/timezone.php +++ b/phpBB/phpbb/db/migration/data/310/timezone.php diff --git a/phpBB/includes/db/migration/data/310/timezone_p2.php b/phpBB/phpbb/db/migration/data/310/timezone_p2.php index 113b979e4f..113b979e4f 100644 --- a/phpBB/includes/db/migration/data/310/timezone_p2.php +++ b/phpBB/phpbb/db/migration/data/310/timezone_p2.php diff --git a/phpBB/includes/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php index e84330dd71..e84330dd71 100644 --- a/phpBB/includes/db/migration/exception.php +++ b/phpBB/phpbb/db/migration/exception.php diff --git a/phpBB/includes/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php index 0ffa96fd14..0ffa96fd14 100644 --- a/phpBB/includes/db/migration/migration.php +++ b/phpBB/phpbb/db/migration/migration.php diff --git a/phpBB/includes/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index 0b626bf455..0b626bf455 100644 --- a/phpBB/includes/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php diff --git a/phpBB/includes/db/migration/tool/interface.php b/phpBB/phpbb/db/migration/tool/interface.php index ced53b2023..ced53b2023 100644 --- a/phpBB/includes/db/migration/tool/interface.php +++ b/phpBB/phpbb/db/migration/tool/interface.php diff --git a/phpBB/includes/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index ac4d2c9bd7..ac4d2c9bd7 100644 --- a/phpBB/includes/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php diff --git a/phpBB/includes/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index 2f09c0ac72..2f09c0ac72 100644 --- a/phpBB/includes/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php diff --git a/phpBB/includes/db/migrator.php b/phpBB/phpbb/db/migrator.php index ca3ffc8043..ca3ffc8043 100644 --- a/phpBB/includes/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php diff --git a/phpBB/includes/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php index c18f908429..c18f908429 100644 --- a/phpBB/includes/db/sql_insert_buffer.php +++ b/phpBB/phpbb/db/sql_insert_buffer.php diff --git a/phpBB/includes/db/db_tools.php b/phpBB/phpbb/db/tools.php index 983cdc18ea..492284ffcd 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/phpbb/db/tools.php @@ -303,7 +303,7 @@ class phpbb_db_tools * @param phpbb_db_driver $db Database connection * @param bool $return_statements True if only statements should be returned and no SQL being executed */ - function phpbb_db_tools(phpbb_db_driver $db, $return_statements = false) + public function __construct(phpbb_db_driver $db, $return_statements = false) { $this->db = $db; $this->return_statements = $return_statements; diff --git a/phpBB/includes/di/extension/config.php b/phpBB/phpbb/di/extension/config.php index 6c272a6588..6c272a6588 100644 --- a/phpBB/includes/di/extension/config.php +++ b/phpBB/phpbb/di/extension/config.php diff --git a/phpBB/includes/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index 9c36ba2fc4..9d59a24b7e 100644 --- a/phpBB/includes/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -26,19 +26,19 @@ use Symfony\Component\Config\FileLocator; class phpbb_di_extension_core extends Extension { /** - * phpBB Root path + * Config path * @var string */ - protected $root_path; + protected $config_path; /** * Constructor * - * @param string $root_path Root path + * @param string $config_path Config path */ - public function __construct($root_path) + public function __construct($config_path) { - $this->root_path = $root_path; + $this->config_path = $config_path; } /** @@ -51,7 +51,7 @@ class phpbb_di_extension_core extends Extension */ public function load(array $config, ContainerBuilder $container) { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'config'))); + $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->config_path))); $loader->load('services.yml'); } 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..d6284a52fb 100644 --- a/phpBB/includes/event/extension_subscriber_loader.php +++ b/phpBB/phpbb/event/extension_subscriber_loader.php @@ -33,7 +33,6 @@ class phpbb_event_extension_subscriber_loader $finder = $this->extension_manager->get_finder(); $subscriber_classes = $finder ->extension_directory('/event') - ->suffix('listener') ->core_path('event/') ->get_classes(); 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 296d830932..296d830932 100644 --- a/phpBB/includes/feed/base.php +++ b/phpBB/phpbb/feed/base.php 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 b5f0dd0f8f..b5f0dd0f8f 100644 --- a/phpBB/includes/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php diff --git a/phpBB/includes/feed/forums.php b/phpBB/phpbb/feed/forums.php index 409097a9f3..409097a9f3 100644 --- a/phpBB/includes/feed/forums.php +++ b/phpBB/phpbb/feed/forums.php 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 f2d45b5165..f2d45b5165 100644 --- a/phpBB/includes/feed/news.php +++ b/phpBB/phpbb/feed/news.php diff --git a/phpBB/includes/feed/overall.php b/phpBB/phpbb/feed/overall.php index 869df7cde0..224d97ec03 100644 --- a/phpBB/includes/feed/overall.php +++ b/phpBB/phpbb/feed/overall.php @@ -72,7 +72,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base ), ), 'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . ' - AND ' . $this->content_visibility->get_visibility_sql('post', array(), 'p.') . ' + AND ' . $this->content_visibility->get_forums_visibility_sql('post', $forum_ids, 'p.') . ' AND p.post_time >= ' . $min_post_time . ' AND u.user_id = p.poster_id', 'ORDER_BY' => 'p.post_time DESC', diff --git a/phpBB/includes/feed/post_base.php b/phpBB/phpbb/feed/post_base.php index 1f4cb4b5ef..1f4cb4b5ef 100644 --- a/phpBB/includes/feed/post_base.php +++ b/phpBB/phpbb/feed/post_base.php diff --git a/phpBB/includes/feed/topic.php b/phpBB/phpbb/feed/topic.php index 36f958ac60..bb1753d823 100644 --- a/phpBB/includes/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -43,7 +43,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base function open() { - $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type + $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_posts_approved, t.topic_type FROM ' . TOPICS_TABLE . ' t LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id) @@ -60,7 +60,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base $this->forum_id = (int) $this->topic_data['forum_id']; // Make sure topic is either approved or user authed - if (!$this->topic_data['topic_approved'] && !$this->auth->acl_get('m_approve', $this->forum_id)) + if ($this->topic_data['topic_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $this->forum_id)) { trigger_error('SORRY_AUTH_READ'); } diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php index b104a46631..b104a46631 100644 --- a/phpBB/includes/feed/topic_base.php +++ b/phpBB/phpbb/feed/topic_base.php diff --git a/phpBB/includes/feed/topics.php b/phpBB/phpbb/feed/topics.php index 31f5177773..31f5177773 100644 --- a/phpBB/includes/feed/topics.php +++ b/phpBB/phpbb/feed/topics.php diff --git a/phpBB/includes/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php index 249dd1d66a..249dd1d66a 100644 --- a/phpBB/includes/feed/topics_active.php +++ b/phpBB/phpbb/feed/topics_active.php diff --git a/phpBB/includes/filesystem.php b/phpBB/phpbb/filesystem.php index 27cab48fb0..27cab48fb0 100644 --- a/phpBB/includes/filesystem.php +++ b/phpBB/phpbb/filesystem.php diff --git a/phpBB/includes/groupposition/exception.php b/phpBB/phpbb/groupposition/exception.php index e4ff09c703..e4ff09c703 100644 --- a/phpBB/includes/groupposition/exception.php +++ b/phpBB/phpbb/groupposition/exception.php diff --git a/phpBB/includes/groupposition/interface.php b/phpBB/phpbb/groupposition/interface.php index eacc04e1a4..eacc04e1a4 100644 --- a/phpBB/includes/groupposition/interface.php +++ b/phpBB/phpbb/groupposition/interface.php diff --git a/phpBB/includes/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php index 7fddadde99..7fddadde99 100644 --- a/phpBB/includes/groupposition/legend.php +++ b/phpBB/phpbb/groupposition/legend.php diff --git a/phpBB/includes/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php index 7c758199e7..7c758199e7 100644 --- a/phpBB/includes/groupposition/teampage.php +++ b/phpBB/phpbb/groupposition/teampage.php diff --git a/phpBB/includes/hook/finder.php b/phpBB/phpbb/hook/finder.php index 7b0412f733..7b0412f733 100644 --- a/phpBB/includes/hook/finder.php +++ b/phpBB/phpbb/hook/finder.php diff --git a/phpBB/includes/json_response.php b/phpBB/phpbb/json_response.php index 5dd904da09..5dd904da09 100644 --- a/phpBB/includes/json_response.php +++ b/phpBB/phpbb/json_response.php diff --git a/phpBB/includes/lock/db.php b/phpBB/phpbb/lock/db.php index 5cc0821aa0..5cc0821aa0 100644 --- a/phpBB/includes/lock/db.php +++ b/phpBB/phpbb/lock/db.php diff --git a/phpBB/includes/lock/flock.php b/phpBB/phpbb/lock/flock.php index 17de0847c0..17de0847c0 100644 --- a/phpBB/includes/lock/flock.php +++ b/phpBB/phpbb/lock/flock.php diff --git a/phpBB/includes/log/interface.php b/phpBB/phpbb/log/interface.php index 3b459c9bdf..3b459c9bdf 100644 --- a/phpBB/includes/log/interface.php +++ b/phpBB/phpbb/log/interface.php diff --git a/phpBB/includes/log/log.php b/phpBB/phpbb/log/log.php index 7a26858348..7a26858348 100644 --- a/phpBB/includes/log/log.php +++ b/phpBB/phpbb/log/log.php diff --git a/phpBB/includes/notification/exception.php b/phpBB/phpbb/notification/exception.php index a52d6fdc57..a52d6fdc57 100644 --- a/phpBB/includes/notification/exception.php +++ b/phpBB/phpbb/notification/exception.php diff --git a/phpBB/includes/notification/manager.php b/phpBB/phpbb/notification/manager.php index 97833710c0..97833710c0 100644 --- a/phpBB/includes/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php diff --git a/phpBB/includes/notification/method/base.php b/phpBB/phpbb/notification/method/base.php index b633956d01..b633956d01 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/phpbb/notification/method/base.php diff --git a/phpBB/includes/notification/method/email.php b/phpBB/phpbb/notification/method/email.php index 571b0ec656..571b0ec656 100644 --- a/phpBB/includes/notification/method/email.php +++ b/phpBB/phpbb/notification/method/email.php diff --git a/phpBB/includes/notification/method/interface.php b/phpBB/phpbb/notification/method/interface.php index ef875942cc..ef875942cc 100644 --- a/phpBB/includes/notification/method/interface.php +++ b/phpBB/phpbb/notification/method/interface.php diff --git a/phpBB/includes/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php index d3b756d020..d3b756d020 100644 --- a/phpBB/includes/notification/method/jabber.php +++ b/phpBB/phpbb/notification/method/jabber.php diff --git a/phpBB/includes/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 4966aa94bc..4966aa94bc 100644 --- a/phpBB/includes/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php diff --git a/phpBB/includes/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php index 1a30781c35..1a30781c35 100644 --- a/phpBB/includes/notification/type/approve_post.php +++ b/phpBB/phpbb/notification/type/approve_post.php diff --git a/phpBB/includes/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php index e728e9ac30..e728e9ac30 100644 --- a/phpBB/includes/notification/type/approve_topic.php +++ b/phpBB/phpbb/notification/type/approve_topic.php diff --git a/phpBB/includes/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 46517f1c9b..46517f1c9b 100644 --- a/phpBB/includes/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index ae2e75d3eb..ae2e75d3eb 100644 --- a/phpBB/includes/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php diff --git a/phpBB/includes/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php index 951c7e0254..951c7e0254 100644 --- a/phpBB/includes/notification/type/disapprove_post.php +++ b/phpBB/phpbb/notification/type/disapprove_post.php diff --git a/phpBB/includes/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php index 038e528797..038e528797 100644 --- a/phpBB/includes/notification/type/disapprove_topic.php +++ b/phpBB/phpbb/notification/type/disapprove_topic.php diff --git a/phpBB/includes/notification/type/interface.php b/phpBB/phpbb/notification/type/interface.php index a40fdafd09..a40fdafd09 100644 --- a/phpBB/includes/notification/type/interface.php +++ b/phpBB/phpbb/notification/type/interface.php diff --git a/phpBB/includes/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index b3db7ad5ad..b3db7ad5ad 100644 --- a/phpBB/includes/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php diff --git a/phpBB/includes/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 9207fd866e..9207fd866e 100644 --- a/phpBB/includes/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php index bc4b15cdc3..bc4b15cdc3 100644 --- a/phpBB/includes/notification/type/post_in_queue.php +++ b/phpBB/phpbb/notification/type/post_in_queue.php diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 0ed13f36fb..0ed13f36fb 100644 --- a/phpBB/includes/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php diff --git a/phpBB/includes/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 3fa73bab41..3fa73bab41 100644 --- a/phpBB/includes/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php diff --git a/phpBB/includes/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index 63dfa92064..63dfa92064 100644 --- a/phpBB/includes/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php diff --git a/phpBB/includes/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index de5c54a291..de5c54a291 100644 --- a/phpBB/includes/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php diff --git a/phpBB/includes/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index 3916cd8db7..3916cd8db7 100644 --- a/phpBB/includes/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 22436d3fb1..22436d3fb1 100644 --- a/phpBB/includes/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php diff --git a/phpBB/includes/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php index f735e10c00..f735e10c00 100644 --- a/phpBB/includes/notification/type/topic_in_queue.php +++ b/phpBB/phpbb/notification/type/topic_in_queue.php diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php new file mode 100644 index 0000000000..0fbacdad8a --- /dev/null +++ b/phpBB/phpbb/permissions.php @@ -0,0 +1,340 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class phpbb_permissions +{ + /** + * Event dispatcher object + * @var phpbb_event_dispatcher + */ + protected $dispatcher; + + /** + * User object + * @var phpbb_user + */ + protected $user; + + /** + * Constructor + * + * @param phpbb_event_dispatcher $phpbb_dispatcher Event dispatcher + * @param phpbb_user $user User Object + * @return null + */ + public function __construct(phpbb_event_dispatcher $phpbb_dispatcher, phpbb_user $user) + { + $this->dispatcher = $phpbb_dispatcher; + $this->user = $user; + + $categories = $this->categories; + $types = $this->types; + $permissions = $this->permissions; + + /** + * Allows to specify additional permission categories, types and permissions + * + * @event core.permissions + * @var array types Array with permission types (a_, u_, m_, etc.) + * @var array categories Array with permission categories (pm, post, settings, misc, etc.) + * @var array permissions Array with permissions. Each Permission has the following layout: + * '<type><permission>' => array( + * 'lang' => 'Language Key with a Short description', // Optional, if not set, + * // the permissions identifier '<type><permission>' is used with + * // all uppercase. + * 'cat' => 'Identifier of the category, the permission should be displayed in', + * ), + * Example: + * 'u_viewprofile' => array( + * 'lang' => 'ACL_U_VIEWPROFILE', + * 'cat' => 'profile', + * ), + * @since 3.1-A1 + */ + $vars = array('types', 'categories', 'permissions'); + extract($phpbb_dispatcher->trigger_event('core.permissions', compact($vars))); + + $this->categories = $categories; + $this->types = $types; + $this->permissions = $permissions; + } + + /** + * Returns an array with all the permission categories (pm, post, settings, misc, etc.) + * + * @return array Layout: cat-identifier => Language key + */ + public function get_categories() + { + return $this->categories; + } + + /** + * Returns the language string of a permission category + * + * @param string $category Identifier of the category + * @return string Language string + */ + public function get_category_lang($category) + { + return $this->user->lang($this->categories[$category]); + } + + /** + * Returns an array with all the permission types (a_, u_, m_, etc.) + * + * @return array Layout: type-identifier => Language key + */ + public function get_types() + { + return $this->types; + } + + /** + * Returns the language string of a permission type + * + * @param string $type Identifier of the type + * @param mixed $scope Scope of the type (should be 'global', 'local' or false) + * @return string Language string + */ + public function get_type_lang($type, $scope = false) + { + if ($scope && isset($this->types[$scope][$type])) + { + $lang_key = $this->types[$scope][$type]; + } + else if (isset($this->types[$type])) + { + $lang_key = $this->types[$type]; + } + else + { + $lang_key = 'ACL_TYPE_' . strtoupper(($scope) ? $scope . '_' . $type : $type); + } + + return $this->user->lang($lang_key); + } + + /** + * Returns an array with all the permissions. + * Each Permission has the following layout: + * '<type><permission>' => array( + * 'lang' => 'Language Key with a Short description', // Optional, if not set, + * // the permissions identifier '<type><permission>' is used with + * // all uppercase. + * 'cat' => 'Identifier of the category, the permission should be displayed in', + * ), + * Example: + * 'u_viewprofile' => array( + * 'lang' => 'ACL_U_VIEWPROFILE', + * 'cat' => 'profile', + * ), + * + * @return array + */ + public function get_permissions() + { + return $this->permissions; + } + + /** + * Returns the category of a permission + * + * @param string $permission Identifier of the permission + * @return string Returns the category identifier of the permission + */ + public function get_permission_category($permission) + { + return (isset($this->permissions[$permission]['cat'])) ? $this->permissions[$permission]['cat'] : 'misc'; + } + + /** + * Returns the language string of a permission + * + * @param string $permission Identifier of the permission + * @return string Language string + */ + public function get_permission_lang($permission) + { + return (isset($this->permissions[$permission]['lang'])) ? $this->user->lang($this->permissions[$permission]['lang']) : $this->user->lang('ACL_' . strtoupper($permission)); + } + + protected $types = array( + 'u_' => 'ACL_TYPE_U_', + 'a_' => 'ACL_TYPE_A_', + 'm_' => 'ACL_TYPE_M_', + 'f_' => 'ACL_TYPE_F_', + 'global' => array( + 'm_' => 'ACL_TYPE_GLOBAL_M_', + ), + ); + + protected $categories = array( + 'actions' => 'ACL_CAT_ACTIONS', + 'content' => 'ACL_CAT_CONTENT', + 'forums' => 'ACL_CAT_FORUMS', + 'misc' => 'ACL_CAT_MISC', + 'permissions' => 'ACL_CAT_PERMISSIONS', + 'pm' => 'ACL_CAT_PM', + 'polls' => 'ACL_CAT_POLLS', + 'post' => 'ACL_CAT_POST', + 'post_actions' => 'ACL_CAT_POST_ACTIONS', + 'posting' => 'ACL_CAT_POSTING', + 'profile' => 'ACL_CAT_PROFILE', + 'settings' => 'ACL_CAT_SETTINGS', + 'topic_actions' => 'ACL_CAT_TOPIC_ACTIONS', + 'user_group' => 'ACL_CAT_USER_GROUP', + ); + + protected $permissions = array( + // User Permissions + 'u_viewprofile' => array('lang' => 'ACL_U_VIEWPROFILE', 'cat' => 'profile'), + 'u_chgname' => array('lang' => 'ACL_U_CHGNAME', 'cat' => 'profile'), + 'u_chgpasswd' => array('lang' => 'ACL_U_CHGPASSWD', 'cat' => 'profile'), + 'u_chgemail' => array('lang' => 'ACL_U_CHGEMAIL', 'cat' => 'profile'), + 'u_chgavatar' => array('lang' => 'ACL_U_CHGAVATAR', 'cat' => 'profile'), + 'u_chggrp' => array('lang' => 'ACL_U_CHGGRP', 'cat' => 'profile'), + 'u_chgprofileinfo' => array('lang' => 'ACL_U_CHGPROFILEINFO', 'cat' => 'profile'), + + 'u_attach' => array('lang' => 'ACL_U_ATTACH', 'cat' => 'post'), + 'u_download' => array('lang' => 'ACL_U_DOWNLOAD', 'cat' => 'post'), + 'u_savedrafts' => array('lang' => 'ACL_U_SAVEDRAFTS', 'cat' => 'post'), + 'u_chgcensors' => array('lang' => 'ACL_U_CHGCENSORS', 'cat' => 'post'), + 'u_sig' => array('lang' => 'ACL_U_SIG', 'cat' => 'post'), + + 'u_sendpm' => array('lang' => 'ACL_U_SENDPM', 'cat' => 'pm'), + 'u_masspm' => array('lang' => 'ACL_U_MASSPM', 'cat' => 'pm'), + 'u_masspm_group'=> array('lang' => 'ACL_U_MASSPM_GROUP', 'cat' => 'pm'), + 'u_readpm' => array('lang' => 'ACL_U_READPM', 'cat' => 'pm'), + 'u_pm_edit' => array('lang' => 'ACL_U_PM_EDIT', 'cat' => 'pm'), + 'u_pm_delete' => array('lang' => 'ACL_U_PM_DELETE', 'cat' => 'pm'), + 'u_pm_forward' => array('lang' => 'ACL_U_PM_FORWARD', 'cat' => 'pm'), + 'u_pm_emailpm' => array('lang' => 'ACL_U_PM_EMAILPM', 'cat' => 'pm'), + 'u_pm_printpm' => array('lang' => 'ACL_U_PM_PRINTPM', 'cat' => 'pm'), + 'u_pm_attach' => array('lang' => 'ACL_U_PM_ATTACH', 'cat' => 'pm'), + 'u_pm_download' => array('lang' => 'ACL_U_PM_DOWNLOAD', 'cat' => 'pm'), + 'u_pm_bbcode' => array('lang' => 'ACL_U_PM_BBCODE', 'cat' => 'pm'), + 'u_pm_smilies' => array('lang' => 'ACL_U_PM_SMILIES', 'cat' => 'pm'), + 'u_pm_img' => array('lang' => 'ACL_U_PM_IMG', 'cat' => 'pm'), + 'u_pm_flash' => array('lang' => 'ACL_U_PM_FLASH', 'cat' => 'pm'), + + 'u_sendemail' => array('lang' => 'ACL_U_SENDEMAIL', 'cat' => 'misc'), + 'u_sendim' => array('lang' => 'ACL_U_SENDIM', 'cat' => 'misc'), + 'u_ignoreflood' => array('lang' => 'ACL_U_IGNOREFLOOD', 'cat' => 'misc'), + 'u_hideonline' => array('lang' => 'ACL_U_HIDEONLINE', 'cat' => 'misc'), + 'u_viewonline' => array('lang' => 'ACL_U_VIEWONLINE', 'cat' => 'misc'), + 'u_search' => array('lang' => 'ACL_U_SEARCH', 'cat' => 'misc'), + + // Forum Permissions + 'f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'), + 'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'), + 'f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'), + 'f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'), + 'f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'), + 'f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'), + 'f_bump' => array('lang' => 'ACL_F_BUMP', 'cat' => 'actions'), + 'f_user_lock' => array('lang' => 'ACL_F_USER_LOCK', 'cat' => 'actions'), + 'f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'), + 'f_report' => array('lang' => 'ACL_F_REPORT', 'cat' => 'actions'), + + 'f_post' => array('lang' => 'ACL_F_POST', 'cat' => 'post'), + 'f_sticky' => array('lang' => 'ACL_F_STICKY', 'cat' => 'post'), + 'f_announce' => array('lang' => 'ACL_F_ANNOUNCE', 'cat' => 'post'), + 'f_reply' => array('lang' => 'ACL_F_REPLY', 'cat' => 'post'), + 'f_edit' => array('lang' => 'ACL_F_EDIT', 'cat' => 'post'), + 'f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'), + 'f_ignoreflood' => array('lang' => 'ACL_F_IGNOREFLOOD', 'cat' => 'post'), + 'f_postcount' => array('lang' => 'ACL_F_POSTCOUNT', 'cat' => 'post'), + 'f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'), + + 'f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'), + 'f_icons' => array('lang' => 'ACL_F_ICONS', 'cat' => 'content'), + 'f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'), + 'f_flash' => array('lang' => 'ACL_F_FLASH', 'cat' => 'content'), + 'f_img' => array('lang' => 'ACL_F_IMG', 'cat' => 'content'), + 'f_sigs' => array('lang' => 'ACL_F_SIGS', 'cat' => 'content'), + 'f_smilies' => array('lang' => 'ACL_F_SMILIES', 'cat' => 'content'), + + 'f_poll' => array('lang' => 'ACL_F_POLL', 'cat' => 'polls'), + 'f_vote' => array('lang' => 'ACL_F_VOTE', 'cat' => 'polls'), + 'f_votechg' => array('lang' => 'ACL_F_VOTECHG', 'cat' => 'polls'), + + // Moderator Permissions + 'm_edit' => array('lang' => 'ACL_M_EDIT', 'cat' => 'post_actions'), + 'm_delete' => array('lang' => 'ACL_M_DELETE', 'cat' => 'post_actions'), + 'm_approve' => array('lang' => 'ACL_M_APPROVE', 'cat' => 'post_actions'), + 'm_report' => array('lang' => 'ACL_M_REPORT', 'cat' => 'post_actions'), + 'm_chgposter' => array('lang' => 'ACL_M_CHGPOSTER', 'cat' => 'post_actions'), + + 'm_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'), + 'm_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'), + 'm_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'), + 'm_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'), + + 'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'misc'), + 'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'), + 'm_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'), + + // Admin Permissions + 'a_board' => array('lang' => 'ACL_A_BOARD', 'cat' => 'settings'), + 'a_server' => array('lang' => 'ACL_A_SERVER', 'cat' => 'settings'), + 'a_jabber' => array('lang' => 'ACL_A_JABBER', 'cat' => 'settings'), + 'a_phpinfo' => array('lang' => 'ACL_A_PHPINFO', 'cat' => 'settings'), + + 'a_forum' => array('lang' => 'ACL_A_FORUM', 'cat' => 'forums'), + 'a_forumadd' => array('lang' => 'ACL_A_FORUMADD', 'cat' => 'forums'), + 'a_forumdel' => array('lang' => 'ACL_A_FORUMDEL', 'cat' => 'forums'), + 'a_prune' => array('lang' => 'ACL_A_PRUNE', 'cat' => 'forums'), + + 'a_icons' => array('lang' => 'ACL_A_ICONS', 'cat' => 'posting'), + 'a_words' => array('lang' => 'ACL_A_WORDS', 'cat' => 'posting'), + 'a_bbcode' => array('lang' => 'ACL_A_BBCODE', 'cat' => 'posting'), + 'a_attach' => array('lang' => 'ACL_A_ATTACH', 'cat' => 'posting'), + + 'a_user' => array('lang' => 'ACL_A_USER', 'cat' => 'user_group'), + 'a_userdel' => array('lang' => 'ACL_A_USERDEL', 'cat' => 'user_group'), + 'a_group' => array('lang' => 'ACL_A_GROUP', 'cat' => 'user_group'), + 'a_groupadd' => array('lang' => 'ACL_A_GROUPADD', 'cat' => 'user_group'), + 'a_groupdel' => array('lang' => 'ACL_A_GROUPDEL', 'cat' => 'user_group'), + 'a_ranks' => array('lang' => 'ACL_A_RANKS', 'cat' => 'user_group'), + 'a_profile' => array('lang' => 'ACL_A_PROFILE', 'cat' => 'user_group'), + 'a_names' => array('lang' => 'ACL_A_NAMES', 'cat' => 'user_group'), + 'a_ban' => array('lang' => 'ACL_A_BAN', 'cat' => 'user_group'), + + 'a_viewauth' => array('lang' => 'ACL_A_VIEWAUTH', 'cat' => 'permissions'), + 'a_authgroups' => array('lang' => 'ACL_A_AUTHGROUPS', 'cat' => 'permissions'), + 'a_authusers' => array('lang' => 'ACL_A_AUTHUSERS', 'cat' => 'permissions'), + 'a_fauth' => array('lang' => 'ACL_A_FAUTH', 'cat' => 'permissions'), + 'a_mauth' => array('lang' => 'ACL_A_MAUTH', 'cat' => 'permissions'), + 'a_aauth' => array('lang' => 'ACL_A_AAUTH', 'cat' => 'permissions'), + 'a_uauth' => array('lang' => 'ACL_A_UAUTH', 'cat' => 'permissions'), + 'a_roles' => array('lang' => 'ACL_A_ROLES', 'cat' => 'permissions'), + 'a_switchperm' => array('lang' => 'ACL_A_SWITCHPERM', 'cat' => 'permissions'), + + 'a_styles' => array('lang' => 'ACL_A_STYLES', 'cat' => 'misc'), + 'a_extensions' => array('lang' => 'ACL_A_EXTENSIONS', 'cat' => 'misc'), + 'a_viewlogs' => array('lang' => 'ACL_A_VIEWLOGS', 'cat' => 'misc'), + 'a_clearlogs' => array('lang' => 'ACL_A_CLEARLOGS', 'cat' => 'misc'), + 'a_modules' => array('lang' => 'ACL_A_MODULES', 'cat' => 'misc'), + 'a_language' => array('lang' => 'ACL_A_LANGUAGE', 'cat' => 'misc'), + 'a_email' => array('lang' => 'ACL_A_EMAIL', 'cat' => 'misc'), + 'a_bots' => array('lang' => 'ACL_A_BOTS', 'cat' => 'misc'), + 'a_reasons' => array('lang' => 'ACL_A_REASONS', 'cat' => 'misc'), + 'a_backup' => array('lang' => 'ACL_A_BACKUP', 'cat' => 'misc'), + 'a_search' => array('lang' => 'ACL_A_SEARCH', 'cat' => 'misc'), + ); +} diff --git a/phpBB/includes/php/ini.php b/phpBB/phpbb/php/ini.php index 17e8c54a57..17e8c54a57 100644 --- a/phpBB/includes/php/ini.php +++ b/phpBB/phpbb/php/ini.php diff --git a/phpBB/includes/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php index cc05847ec7..cc05847ec7 100644 --- a/phpBB/includes/request/deactivated_super_global.php +++ b/phpBB/phpbb/request/deactivated_super_global.php diff --git a/phpBB/includes/request/interface.php b/phpBB/phpbb/request/interface.php index 741db35917..741db35917 100644 --- a/phpBB/includes/request/interface.php +++ b/phpBB/phpbb/request/interface.php diff --git a/phpBB/includes/request/request.php b/phpBB/phpbb/request/request.php index ae3c526d89..ae3c526d89 100644 --- a/phpBB/includes/request/request.php +++ b/phpBB/phpbb/request/request.php diff --git a/phpBB/includes/request/type_cast_helper.php b/phpBB/phpbb/request/type_cast_helper.php index 1a5274ed14..1a5274ed14 100644 --- a/phpBB/includes/request/type_cast_helper.php +++ b/phpBB/phpbb/request/type_cast_helper.php diff --git a/phpBB/includes/request/type_cast_helper_interface.php b/phpBB/phpbb/request/type_cast_helper_interface.php index 3920d16fc7..3920d16fc7 100644 --- a/phpBB/includes/request/type_cast_helper_interface.php +++ b/phpBB/phpbb/request/type_cast_helper_interface.php diff --git a/phpBB/includes/search/base.php b/phpBB/phpbb/search/base.php index 914cef9167..914cef9167 100644 --- a/phpBB/includes/search/base.php +++ b/phpBB/phpbb/search/base.php diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index 7dc4da8ffe..a1e1b089b9 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -542,7 +542,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base * @param int $per_page number of ids each page is supposed to contain * @return boolean|int total number of results */ - public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) { // No author? No posts if (!sizeof($author_ary)) diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 730c3a6c2d..730c3a6c2d 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index 6b4b310f2e..6b4b310f2e 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 2f7b236c78..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); diff --git a/phpBB/includes/search/index.htm b/phpBB/phpbb/search/index.htm index ee1f723a7d..ee1f723a7d 100644 --- a/phpBB/includes/search/index.htm +++ b/phpBB/phpbb/search/index.htm diff --git a/phpBB/includes/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php index f1864f0c8c..f1864f0c8c 100644 --- a/phpBB/includes/search/sphinx/config.php +++ b/phpBB/phpbb/search/sphinx/config.php diff --git a/phpBB/includes/search/sphinx/config_comment.php b/phpBB/phpbb/search/sphinx/config_comment.php index 7f695dbf0c..7f695dbf0c 100644 --- a/phpBB/includes/search/sphinx/config_comment.php +++ b/phpBB/phpbb/search/sphinx/config_comment.php diff --git a/phpBB/includes/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php index 79c9c8563d..79c9c8563d 100644 --- a/phpBB/includes/search/sphinx/config_section.php +++ b/phpBB/phpbb/search/sphinx/config_section.php diff --git a/phpBB/includes/search/sphinx/config_variable.php b/phpBB/phpbb/search/sphinx/config_variable.php index 2c1d35a49c..2c1d35a49c 100644 --- a/phpBB/includes/search/sphinx/config_variable.php +++ b/phpBB/phpbb/search/sphinx/config_variable.php diff --git a/phpBB/includes/session.php b/phpBB/phpbb/session.php index e0585b1523..dc33786666 100644 --- a/phpBB/includes/session.php +++ b/phpBB/phpbb/session.php @@ -1022,7 +1022,8 @@ class phpbb_session { include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); } - phpbb_captcha_factory::garbage_collect($config['captcha_plugin']); + $captcha_factory = new phpbb_captcha_factory(); + $captcha_factory->garbage_collect($config['captcha_plugin']); $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . ' WHERE attempt_time < ' . (time() - (int) $config['ip_login_limit_time']); diff --git a/phpBB/includes/template/asset.php b/phpBB/phpbb/template/asset.php index 7c322cd971..7c322cd971 100644 --- a/phpBB/includes/template/asset.php +++ b/phpBB/phpbb/template/asset.php diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php new file mode 100644 index 0000000000..3778424a96 --- /dev/null +++ b/phpBB/phpbb/template/base.php @@ -0,0 +1,148 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +abstract class phpbb_template_base implements phpbb_template +{ + /** + * Template context. + * Stores template data used during template rendering. + * + * @var phpbb_template_context + */ + protected $context; + + /** + * Array of filenames assigned to set_filenames + * + * @var array + */ + protected $filenames = array(); + + /** + * {@inheritdoc} + */ + public function set_filenames(array $filename_array) + { + $this->filenames = array_merge($this->filenames, $filename_array); + + return $this; + } + + /** + * 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; + } + + /** + * {@inheritdoc} + */ + public function destroy() + { + $this->context->clear(); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function destroy_block_vars($blockname) + { + $this->context->destroy_block_vars($blockname); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function assign_vars(array $vararray) + { + foreach ($vararray as $key => $val) + { + $this->assign_var($key, $val); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function assign_var($varname, $varval) + { + $this->context->assign_var($varname, $varval); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function append_var($varname, $varval) + { + $this->context->append_var($varname, $varval); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function assign_block_vars($blockname, array $vararray) + { + $this->context->assign_block_vars($blockname, $vararray); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert') + { + return $this->context->alter_block_array($blockname, $vararray, $key, $mode); + } + + /** + * 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; + } +} diff --git a/phpBB/includes/template/context.php b/phpBB/phpbb/template/context.php index c5ce7422b9..c5ce7422b9 100644 --- a/phpBB/includes/template/context.php +++ b/phpBB/phpbb/template/context.php diff --git a/phpBB/includes/template/template.php b/phpBB/phpbb/template/template.php index 89a01e924d..6b9c331a3e 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -34,14 +34,32 @@ interface phpbb_template public function set_filenames(array $filename_array); /** - * Sets the style names/paths corresponding to style hierarchy being compiled - * and/or rendered. + * Get the style tree of the style preferred by the current user * - * @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 array Style tree, most specific first + */ + public function get_user_style(); + + /** + * 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 phpbb_template $this + */ + public function set_style($style_directories = array('styles')); + + /** + * Set custom style location (able to use directory outside of phpBB). + * + * Note: Templates are still compiled to phpBB's cache directory. + * + * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. + * @param string|array or string $paths Array of style paths, relative to current root directory * @return phpbb_template $this */ - public function set_style_names(array $style_names, array $style_paths); + public function set_custom_style($names, $paths); /** * Clears all variables and blocks assigned to this template. diff --git a/phpBB/includes/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php index 6557b209eb..6557b209eb 100644 --- a/phpBB/includes/template/twig/definition.php +++ b/phpBB/phpbb/template/twig/definition.php diff --git a/phpBB/includes/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index b60cd72325..b60cd72325 100644 --- a/phpBB/includes/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index c279726434..c279726434 100644 --- a/phpBB/includes/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 46412ad048..a33de70d69 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -126,10 +126,14 @@ class phpbb_template_twig_lexer extends Twig_Lexer { $callback = function($matches) { - // Remove any quotes that may have been used in different implementations - // E.g. DEFINE $TEST = 'blah' vs INCLUDE foo - // Replace {} with start/end to parse variables (' ~ TEST ~ '.html) - $matches[2] = str_replace(array('"', "'", '{', '}'), array('', '', "' ~ ", " ~ '"), $matches[2]); + // Remove matching quotes at the beginning/end if a statement; + // E.g. 'asdf'"' -> asdf'" + // E.g. "asdf'"" -> asdf'" + // E.g. 'asdf'" -> 'asdf'" + $matches[2] = preg_replace('#^([\'"])?(.+?)\1$#', '$2', $matches[2]); + + // Replace template variables with start/end to parse variables (' ~ TEST ~ '.html) + $matches[2] = preg_replace('#{([a-zA-Z0-9_\.$]+)}#', "'~ \$1 ~'", $matches[2]); // Surround the matches in single quotes ('' ~ TEST ~ '.html') return "<!-- {$matches[1]} '{$matches[2]}' -->"; @@ -187,20 +191,18 @@ class phpbb_template_twig_lexer extends Twig_Lexer // 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.' : ''; + $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '.' : ''; 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 %}"; + $parent = ($parent) ?: 'loops.'; + // Turn into a Twig for loop + return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; }; // Replace <!-- BEGINELSE --> correctly, only needs to be done once @@ -217,21 +219,28 @@ class phpbb_template_twig_lexer extends Twig_Lexer */ protected function fix_if_tokens($code) { + // Replace ELSE IF with ELSEIF + $code = preg_replace('#<!-- ELSE IF (.+?) -->#', '<!-- ELSEIF $1 -->', $code); + + // 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); + $callback = function($matches) { + $inner = $matches[2]; // Replace $TEST with definition.TEST - $matches[1] = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $matches[1]); + $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner); - // Replace .test with test|length - $matches[1] = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $matches[1]); + // Replace .foo with loops.foo|length + $inner = preg_replace('#\s\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', ' loops.$1|length$2', $inner); - return '<!-- IF' . $matches[1] . '-->'; - }; + // Replace .foo.bar with foo.bar|length + $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', ' $1|length$2', $inner); - // Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces) - $code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code); + return "<!-- {$matches[1]}IF{$inner}-->"; + }; - return preg_replace_callback('#<!-- IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code); + return preg_replace_callback('#<!-- (ELSE)?IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code); } /** diff --git a/phpBB/includes/template/twig/node/define.php b/phpBB/phpbb/template/twig/node/define.php index fcb19cc773..fcb19cc773 100644 --- a/phpBB/includes/template/twig/node/define.php +++ b/phpBB/phpbb/template/twig/node/define.php diff --git a/phpBB/includes/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 971dea14fa..c94e5fdf20 100644 --- a/phpBB/includes/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -18,6 +18,12 @@ if (!defined('IN_PHPBB')) class phpbb_template_twig_node_event extends Twig_Node { + /** + * The subdirectory in which all template listener files must be placed + * @var string + */ + protected $listener_directory = 'event/'; + /** @var Twig_Environment */ protected $environment; @@ -37,7 +43,7 @@ class phpbb_template_twig_node_event extends Twig_Node { $compiler->addDebugInfo($this); - $location = $this->getNode('expr')->getAttribute('name'); + $location = $this->listener_directory . $this->getNode('expr')->getAttribute('name'); foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path) { diff --git a/phpBB/includes/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php index 8ec2069114..8ec2069114 100644 --- a/phpBB/includes/template/twig/node/expression/binary/equalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php diff --git a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php index 96f32c502e..96f32c502e 100644 --- a/phpBB/includes/template/twig/node/expression/binary/notequalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php diff --git a/phpBB/includes/template/twig/node/include.php b/phpBB/phpbb/template/twig/node/include.php index 5c6ae1bbcf..5c6ae1bbcf 100644 --- a/phpBB/includes/template/twig/node/include.php +++ b/phpBB/phpbb/template/twig/node/include.php diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index 990b1c984f..1cab416c79 100644 --- a/phpBB/includes/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -7,7 +7,7 @@ * */ -class phpbb_template_twig_node_includeasset extends Twig_Node +abstract class phpbb_template_twig_node_includeasset extends Twig_Node { /** @var Twig_Environment */ protected $environment; @@ -57,4 +57,19 @@ class phpbb_template_twig_node_includeasset extends Twig_Node ->raw("\n');\n") ; } + + /** + * Get the definition name + * + * @return string (e.g. 'SCRIPTS') + */ + abstract public function get_definition_name(); + + /** + * Append the output code for the asset + * + * @param Twig_Compiler A Twig_Compiler instance + * @return null + */ + abstract protected function append_asset(Twig_Compiler $compiler); } diff --git a/phpBB/includes/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php index 01fda44aad..a9d9b46d69 100644 --- a/phpBB/includes/template/twig/node/includecss.php +++ b/phpBB/phpbb/template/twig/node/includecss.php @@ -9,16 +9,17 @@ class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_includeasset { + /** + * {@inheritdoc} + */ public function get_definition_name() { return 'STYLESHEETS'; } /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * {@inheritdoc} + */ public function append_asset(Twig_Compiler $compiler) { $compiler diff --git a/phpBB/includes/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php index fdf2bea3ed..2b4b55fb0a 100644 --- a/phpBB/includes/template/twig/node/includejs.php +++ b/phpBB/phpbb/template/twig/node/includejs.php @@ -9,16 +9,17 @@ class phpbb_template_twig_node_includejs extends phpbb_template_twig_node_includeasset { + /** + * {@inheritdoc} + */ public function get_definition_name() { return 'SCRIPTS'; } /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ + * {@inheritdoc} + */ protected function append_asset(Twig_Compiler $compiler) { $config = $this->environment->get_phpbb_config(); diff --git a/phpBB/includes/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php index dbe54f0e1a..dbe54f0e1a 100644 --- a/phpBB/includes/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php diff --git a/phpBB/includes/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php index c11539ea7f..c11539ea7f 100644 --- a/phpBB/includes/template/twig/node/php.php +++ b/phpBB/phpbb/template/twig/node/php.php diff --git a/phpBB/includes/template/twig/tokenparser/define.php b/phpBB/phpbb/template/twig/tokenparser/define.php index 4ea15388c4..4ea15388c4 100644 --- a/phpBB/includes/template/twig/tokenparser/define.php +++ b/phpBB/phpbb/template/twig/tokenparser/define.php diff --git a/phpBB/includes/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php index e4dddd6dcc..e4dddd6dcc 100644 --- a/phpBB/includes/template/twig/tokenparser/event.php +++ b/phpBB/phpbb/template/twig/tokenparser/event.php diff --git a/phpBB/includes/template/twig/tokenparser/include.php b/phpBB/phpbb/template/twig/tokenparser/include.php index 520f9fd1a0..520f9fd1a0 100644 --- a/phpBB/includes/template/twig/tokenparser/include.php +++ b/phpBB/phpbb/template/twig/tokenparser/include.php diff --git a/phpBB/includes/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php index 6c24dda647..6c24dda647 100644 --- a/phpBB/includes/template/twig/tokenparser/includecss.php +++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php diff --git a/phpBB/includes/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php index b02b2f89ba..b02b2f89ba 100644 --- a/phpBB/includes/template/twig/tokenparser/includejs.php +++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php diff --git a/phpBB/includes/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php index 13fe6de8a6..13fe6de8a6 100644 --- a/phpBB/includes/template/twig/tokenparser/includephp.php +++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php diff --git a/phpBB/includes/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php index 197980a59a..197980a59a 100644 --- a/phpBB/includes/template/twig/tokenparser/php.php +++ b/phpBB/phpbb/template/twig/tokenparser/php.php diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php new file mode 100644 index 0000000000..1ed89d3ccc --- /dev/null +++ b/phpBB/phpbb/template/twig/twig.php @@ -0,0 +1,328 @@ +<?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 extends phpbb_template_base +{ + /** + * 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; + + /** + * 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; + + /** + * Twig Environment + * + * @var Twig_Environment + */ + protected $twig; + + /** + * 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->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); + + // Add admin namespace + if ($adm_relative_path !== null && is_dir($this->phpbb_root_path . $adm_relative_path . 'style/')) + { + $this->twig->getLoader()->setPaths($this->phpbb_root_path . $adm_relative_path . 'style/', 'admin'); + } + } + + /** + * Clear the cache + * + * @return phpbb_template + */ + public function clear_cache() + { + if (is_dir($this->cachepath)) + { + $this->twig->clearCacheFiles(); + } + + return $this; + } + + /** + * Get the style tree of the style preferred by the current user + * + * @return array Style tree, most specific first + */ + public function get_user_style() + { + $style_list = array( + $this->user->style['style_path'], + ); + + if ($this->user->style['style_parent_id']) + { + $style_list = array_merge($style_list, array_reverse(explode('/', $this->user->style['style_parent_tree']))); + } + + 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 phpbb_template $this + */ + public function set_style($style_directories = array('styles')) + { + if ($style_directories !== array('styles') && $this->twig->getLoader()->getPaths('core') === array()) + { + // We should set up the core styles path since not already setup + $this->set_style(); + } + + $names = $this->get_user_style(); + + $paths = array(); + foreach ($style_directories as $directory) + { + foreach ($names as $name) + { + $path = $this->phpbb_root_path . trim($directory, '/') . "/{$name}/template/"; + + if (is_dir($path)) + { + $paths[] = $path; + } + } + } + + // If we're setting up the main phpBB styles directory and the core + // namespace isn't setup yet, we will set it up now + if ($style_directories === array('styles') && $this->twig->getLoader()->getPaths('core') === array()) + { + // Set up the core style paths namespace + $this->twig->getLoader()->setPaths($paths, 'core'); + } + + $this->set_custom_style($names, $paths); + + return $this; + } + + /** + * Set custom style location (able to use directory outside of phpBB). + * + * Note: Templates are still compiled to phpBB's cache directory. + * + * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions. + * @param string|array or string $paths Array of style paths, relative to current root directory + * @return phpbb_template $this + */ + public function set_custom_style($names, $paths) + { + $paths = (is_string($paths)) ? array($paths) : $paths; + $names = (is_string($names)) ? array($names) : $names; + + // Set as __main__ namespace + $this->twig->getLoader()->setPaths($paths); + + // Add all namespaces for all extensions + if ($this->extension_manager instanceof phpbb_extension_manager) + { + $names[] = 'all'; + + foreach ($this->extension_manager->all_enabled() as $ext_namespace => $ext_path) + { + // namespaces cannot contain / + $namespace = str_replace('/', '_', $ext_namespace); + $paths = array(); + + foreach ($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; + } + + /** + * 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; + } + + /** + * 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; + } + + /** + * Get template vars in a format Twig will use (from the context) + * + * @return array + */ + protected function get_template_vars() + { + $context_vars = $this->context->get_data_ref(); + + $vars = array_merge( + $context_vars['.'][0], // To get normal vars + array( + 'definition' => new phpbb_template_twig_definition(), + 'user' => $this->user, + 'loops' => $context_vars, // To get loops + ) + ); + + // cleanup + unset($vars['loops']['.']); + + return $vars; + } + + /** + * 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 5530fe3f03..36120798e5 100644 --- a/phpBB/includes/user.php +++ b/phpBB/phpbb/user.php @@ -75,7 +75,7 @@ class phpbb_user extends phpbb_session */ function setup($lang_set = false, $style_id = false) { - global $db, $phpbb_style, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; + global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; global $phpbb_dispatcher; if ($this->data['user_id'] != ANONYMOUS) @@ -128,6 +128,7 @@ class phpbb_user extends phpbb_session } $user_data = $this->data; + $lang_set_ext = array(); /** * Event to load language files and modify user data on every page @@ -139,10 +140,18 @@ class phpbb_user extends phpbb_session * @var string user_timezone User's timezone, should be one of * http://www.php.net/manual/en/timezones.php * @var mixed lang_set String or array of language files + * @var array lang_set_ext Array containing entries of format + * array( + * 'ext_name' => (string) [extension name], + * 'lang_set' => (string|array) [language files], + * ) + * For performance reasons, only load translations + * that are absolutely needed globally using this + * event. Use local events otherwise. * @var mixed style_id Style we are going to display * @since 3.1-A1 */ - $vars = array('user_data', 'user_lang_name', 'user_date_format', 'user_timezone', 'lang_set', 'style_id'); + $vars = array('user_data', 'user_lang_name', 'user_date_format', 'user_timezone', 'lang_set', 'lang_set_ext', 'style_id'); extract($phpbb_dispatcher->trigger_event('core.user_setup', compact($vars))); $this->data = $user_data; @@ -173,6 +182,12 @@ class phpbb_user extends phpbb_session $this->add_lang($lang_set); unset($lang_set); + foreach ($lang_set_ext as $ext_lang_pair) + { + $this->add_lang_ext($ext_lang_pair['ext_name'], $ext_lang_pair['lang_set']); + } + unset($lang_set_ext); + $style_request = request_var('style', 0); if ($style_request && $auth->acl_get('a_styles') && !defined('ADMIN_START')) { @@ -236,7 +251,7 @@ class phpbb_user extends phpbb_session } } - $phpbb_style->set_style(); + $template->set_style(); $this->img_lang = $this->lang_name; @@ -590,6 +605,13 @@ class phpbb_user extends phpbb_session $language_filename = $lang_path . $this->lang_name . '/' . $filename . '.' . $phpEx; } + // If we are in install, try to use the updated version, when available + $install_language_filename = str_replace('language/', 'install/update/new/language/', $language_filename); + if (defined('IN_INSTALL') && file_exists($install_language_filename)) + { + $language_filename = $install_language_filename; + } + if (!file_exists($language_filename)) { global $config; 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/report.php b/phpBB/report.php index 3f2e7a91ff..5081f90ad1 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -139,15 +139,16 @@ else $reported_post_text = $report_data['message_text']; $reported_post_bitfield = $report_data['bbcode_bitfield']; - $reported_post_enable_bbcode = $report_data['reported_post_enable_bbcode']; - $reported_post_enable_smilies = $report_data['reported_post_enable_smilies']; - $reported_post_enable_magic_url = $report_data['reported_post_enable_magic_url']; + $reported_post_uid = $report_data['bbcode_uid']; + $reported_post_enable_bbcode = $report_data['enable_bbcode']; + $reported_post_enable_smilies = $report_data['enable_smilies']; + $reported_post_enable_magic_url = $report_data['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 = phpbb_captcha_factory::get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_REPORT); } @@ -157,10 +158,13 @@ $s_hidden_fields = ''; // Submit report? if ($submit && $reason_id) { - $visual_confirmation_response = $captcha->validate(); - if ($visual_confirmation_response) + if (isset($captcha)) { - $error[] = $visual_confirmation_response; + $visual_confirmation_response = $captcha->validate(); + if ($visual_confirmation_response) + { + $error[] = $visual_confirmation_response; + } } $sql = 'SELECT * diff --git a/phpBB/search.php b/phpBB/search.php index 2429c81dae..40c0b9a8ce 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -366,7 +366,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $sql = "SELECT p.post_id FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t - WHERE t.topic_replies = 0 + WHERE t.topic_posts_approved = 1 AND p.topic_id = t.topic_id $last_post_time AND $m_approve_posts_fid_sql @@ -378,7 +378,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $sql = 'SELECT DISTINCT ' . $sort_by_sql[$sort_key] . ", p.topic_id FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t - WHERE t.topic_replies = 0 + WHERE t.topic_posts_approved = 1 AND t.topic_moved_id = 0 AND p.topic_id = t.topic_id $last_post_time @@ -687,6 +687,18 @@ if ($keywords || $author || $author_id || $search_id || $submit) $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); } + /** + * Event to modify the SQL query before the topic data is retrieved + * + * @event core.search_get_topic_data + * @var string sql_select The SQL SELECT string used by search to get topic data + * @var string sql_from The SQL FROM string used by search to get topic data + * @var string sql_where The SQL WHERE string used by search to get topic data + * @since 3.1-A1 + */ + $vars = array('sql_select', 'sql_from', 'sql_where'); + extract($phpbb_dispatcher->trigger_event('core.search_get_topic_data', compact($vars))); + $sql = "SELECT $sql_select FROM $sql_from WHERE $sql_where"; @@ -989,7 +1001,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) ); } - $template->assign_block_vars('searchresults', array_merge($tpl_ary, array( + $tpl_ary = array_merge($tpl_ary, array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $result_topic_id, 'POST_ID' => ($show_results == 'posts') ? $row['post_id'] : false, @@ -1001,9 +1013,22 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), - 'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '') + 'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '', )); + /** + * Modify the topic data before it is assigned to the template + * + * @event core.search_modify_tpl_ary + * @var array row Array with topic data + * @var array tpl_ary Template block array with topic data + * @since 3.1-A1 + */ + $vars = array('row', 'tpl_ary'); + extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); + + $template->assign_block_vars('searchresults', $tpl_ary); + if ($show_results == 'topics') { phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); diff --git a/phpBB/styles/prosilver/template/bbcode.html b/phpBB/styles/prosilver/template/bbcode.html index c0c0a2da46..909c09df5a 100644 --- a/phpBB/styles/prosilver/template/bbcode.html +++ b/phpBB/styles/prosilver/template/bbcode.html @@ -12,8 +12,8 @@ <!-- BEGIN quote_open --><blockquote class="uncited"><div><!-- END quote_open --> <!-- BEGIN quote_close --></div></blockquote><!-- END quote_close --> -<!-- BEGIN code_open --><dl class="codebox"><dt>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></dt><dd><code><!-- END code_open --> -<!-- BEGIN code_close --></code></dd></dl><!-- END code_close --> +<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><code><!-- END code_open --> +<!-- BEGIN code_close --></code></div><!-- END code_close --> <!-- BEGIN inline_attachment_open --><div class="inline-attachment"><!-- END inline_attachment_open --> <!-- BEGIN inline_attachment_close --></div><!-- END inline_attachment_close --> diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 235cc0025b..4c70ee345f 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -301,7 +301,7 @@ function colorPalette(dir, width, height) { var r = 0, g = 0, b = 0, - numberList = new Array(6); + numberList = new Array(6), color = '', html = ''; diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index 45e6c10d46..e5dcb94855 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -100,20 +100,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_TOPICS --> {TOTAL_TOPICS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_front.html b/phpBB/styles/prosilver/template/mcp_front.html index e88b7c62df..402cfe029a 100644 --- a/phpBB/styles/prosilver/template/mcp_front.html +++ b/phpBB/styles/prosilver/template/mcp_front.html @@ -13,7 +13,7 @@ <p>{L_UNAPPROVED_TOTAL}</p> <!-- IF .unapproved --> - <ul class="topiclist two-long-columns"> + <ul class="topiclist missing-column"> <li class="header"> <dl> <dt><div class="list-inner">{L_VIEW_DETAILS}</div></dt> @@ -21,7 +21,7 @@ </dl> </li> </ul> - <ul class="topiclist cplist two-long-columns"> + <ul class="topiclist cplist missing-column"> <!-- BEGIN unapproved --> <li class="row<!-- IF unapproved.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> diff --git a/phpBB/styles/prosilver/template/mcp_warn_list.html b/phpBB/styles/prosilver/template/mcp_warn_list.html index 69aa185391..cdf2aecc0e 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_list.html +++ b/phpBB/styles/prosilver/template/mcp_warn_list.html @@ -14,20 +14,7 @@ <li class="rightside pagination"> <!-- IF TOTAL_USERS -->{TOTAL_USERS} • <!-- ENDIF --> <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index 07a7e2e182..459c3f6bc6 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -109,7 +109,7 @@ <!-- ENDIF --> <tr class="<!-- IF memberrow.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->"> - <td><!-- IF memberrow.RANK_IMG --><span class="rank-img">{memberrow.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{memberrow.RANK_TITLE}</span><!-- ENDIF --><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input type="checkbox" name="user" value="{memberrow.USERNAME}" /> <!-- ENDIF -->{memberrow.USERNAME_FULL}<!-- IF S_SELECT_SINGLE --><br />[ <a href="#" onclick="insert_single('{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a> ]<!-- ENDIF --></td> + <td><!-- IF memberrow.RANK_IMG --><span class="rank-img">{memberrow.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{memberrow.RANK_TITLE}</span><!-- ENDIF --><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input type="checkbox" name="user" value="{memberrow.USERNAME}" /> <!-- ENDIF --><!-- EVENT memberlist_body_username_prepend -->{memberrow.USERNAME_FULL}<!-- EVENT memberlist_body_username_append --><!-- IF S_SELECT_SINGLE --><br />[ <a href="#" onclick="insert_single('{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a> ]<!-- ENDIF --></td> <td class="posts"><!-- IF memberrow.POSTS and S_DISPLAY_SEARCH --><a href="{memberrow.U_SEARCH_USER}" title="{L_SEARCH_USER_POSTS}">{memberrow.POSTS}</a><!-- ELSE -->{memberrow.POSTS}<!-- ENDIF --></td> <td class="info"><!-- IF memberrow.U_WWW or memberrow.LOCATION --><!-- IF memberrow.U_WWW --><div><a href="{memberrow.U_WWW}" title="{L_VISIT_WEBSITE}{L_COLON} {memberrow.U_WWW}">{memberrow.U_SHORT_WWW}</a></div><!-- ENDIF --><!-- IF memberrow.LOCATION --><div>{memberrow.LOCATION}</div><!-- ENDIF --><!-- ELSE --> <!-- ENDIF --></td> <td>{memberrow.JOINED}</td> diff --git a/phpBB/styles/prosilver/template/memberlist_search.html b/phpBB/styles/prosilver/template/memberlist_search.html index 4f029627fc..f9538ef2e2 100644 --- a/phpBB/styles/prosilver/template/memberlist_search.html +++ b/phpBB/styles/prosilver/template/memberlist_search.html @@ -38,7 +38,6 @@ function insert_single(user) // ]]> </script> <!-- ENDIF --> -<!-- INCLUDEJS forum_fn.js --> <h2 class="solo">{L_FIND_USERNAME}</h2> <form method="post" action="{S_MODE_ACTION}" id="search_memberlist"> diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index 57cfcb86d9..0d103b5914 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -77,6 +77,7 @@ <div class="column2"> <h3>{L_USER_FORUM}</h3> <dl class="details"> + <!-- EVENT memberlist_view_user_statistics_before --> <dt>{L_JOINED}{L_COLON}</dt> <dd>{JOINED}</dd> <dt>{L_VISITED}{L_COLON}</dt> <dd>{VISITED}</dd> <!-- IF S_WARNINGS --> @@ -92,6 +93,7 @@ <dt>{L_ACTIVE_IN_FORUM}{L_COLON}</dt> <dd><!-- IF ACTIVE_FORUM != '' --><strong><a href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></strong><br />({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})<!-- ELSE --> - <!-- ENDIF --></dd> <dt>{L_ACTIVE_IN_TOPIC}{L_COLON}</dt> <dd><!-- IF ACTIVE_TOPIC != '' --><strong><a href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></strong><br />({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})<!-- ELSE --> - <!-- ENDIF --></dd> <!-- ENDIF --> + <!-- EVENT memberlist_view_user_statistics_after --> </dl> </div> <span class="clear"></span></div> diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index ddbd917bd6..c1cdc0c223 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -30,8 +30,6 @@ var on_page = '{ON_PAGE}'; var per_page = '{PER_PAGE}'; var base_url = '{A_BASE_URL}'; - var style_cookie = 'phpBBstyle'; - var style_cookie_settings = '{A_COOKIE_SETTINGS}'; var onload_functions = new Array(); var onunload_functions = new Array(); @@ -177,7 +175,6 @@ <!-- 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_poll_body.html b/phpBB/styles/prosilver/template/posting_poll_body.html index 5bb7e1a3df..a131c10533 100644 --- a/phpBB/styles/prosilver/template/posting_poll_body.html +++ b/phpBB/styles/prosilver/template/posting_poll_body.html @@ -26,7 +26,7 @@ <dl> <dt><label for="poll_max_options">{L_POLL_MAX_OPTIONS}{L_COLON}</label></dt> - <dd><input type="number" min="1" max="999" name="poll_max_options" id="poll_max_options" size="3" maxlength="3" value="{POLL_MAX_OPTIONS}" class="inputbox autowidth" /></dd> + <dd><input type="number" min="0" max="999" name="poll_max_options" id="poll_max_options" size="3" maxlength="3" value="{POLL_MAX_OPTIONS}" class="inputbox autowidth" /></dd> <dd>{L_POLL_MAX_OPTIONS_EXPLAIN}</dd> </dl> <dl> diff --git a/phpBB/styles/prosilver/template/posting_smilies.html b/phpBB/styles/prosilver/template/posting_smilies.html index 01b74c710c..3d56a932b7 100644 --- a/phpBB/styles/prosilver/template/posting_smilies.html +++ b/phpBB/styles/prosilver/template/posting_smilies.html @@ -2,8 +2,8 @@ <script type="text/javascript"> // <![CDATA[ - var form_name = 'postform'; - var text_name = 'message'; + var form_name = opener.form_name; + var text_name = opener.text_name; // ]]> </script> <script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/editor.js"></script> diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index f0424c45db..7603cf4db8 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -63,6 +63,7 @@ <dt <!-- IF searchresults.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{searchresults.TOPIC_FOLDER_IMG_ALT}"> <div class="list-inner"> + <!-- EVENT topiclist_row_prepend --> <!-- 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 --> @@ -83,6 +84,7 @@ </div> <!-- ENDIF --> {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> + <!-- EVENT topiclist_row_append --> </div> </dt> @@ -174,20 +176,7 @@ {SEARCH_MATCHES} <!-- IF .pagination --> • - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --> - <li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --> - <li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --> - <li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/simple_footer.html b/phpBB/styles/prosilver/template/simple_footer.html index 144ae8e462..b6afc2fdba 100644 --- a/phpBB/styles/prosilver/template/simple_footer.html +++ b/phpBB/styles/prosilver/template/simple_footer.html @@ -8,9 +8,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_SUPER_TEMPLATE_PATH}/forum_fn.js?assets_version={T_ASSETS_VERSION}"></script> -{SCRIPTS} +<!-- INCLUDEJS forum_fn.js --> <!-- EVENT simple_footer_after --> + +{$SCRIPTS} + </body> </html> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 667698c371..5bdc539f40 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -14,10 +14,8 @@ var on_page = '{ON_PAGE}'; var per_page = '{PER_PAGE}'; var base_url = '{A_BASE_URL}'; - var style_cookie = 'phpBBstyle'; var onload_functions = new Array(); var onunload_functions = new Array(); - var style_cookie_settings = '{A_COOKIE_SETTINGS}'; /** * New function for handling multiple calls to window.onload and window.unload by pentapenguin diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index c5078df268..9cbff64a6a 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -53,7 +53,7 @@ </dl> </li> </ul> - <ul class="topiclist cplist pmlist two-columns"> + <ul class="topiclist cplist pmlist <!-- IF S_SHOW_RECIPIENTS -->missing-column<!-- ELSE -->two-columns<!-- ENDIF -->"> <!-- BEGIN messagerow --> <li class="row<!-- IF messagerow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF messagerow.PM_CLASS --> {messagerow.PM_CLASS}<!-- ENDIF -->"> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index 22149c8b80..4f2531d3a6 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -85,9 +85,11 @@ <!-- IF AUTHOR_JOINED --><dd><strong>{L_JOINED}{L_COLON}</strong> {AUTHOR_JOINED}</dd><!-- ENDIF --> <!-- IF AUTHOR_FROM --><dd><strong>{L_LOCATION}{L_COLON}</strong> {AUTHOR_FROM}</dd><!-- ENDIF --> + <!-- EVENT ucp_pm_viewmessage_custom_fields_before --> <!-- BEGIN custom_fields --> <dd><strong>{custom_fields.PROFILE_FIELD_NAME}{L_COLON}</strong> {custom_fields.PROFILE_FIELD_VALUE}</dd> <!-- END custom_fields --> + <!-- EVENT ucp_pm_viewmessage_custom_fields_after --> <!-- IF U_PM or U_EMAIL or U_WWW or U_MSN or U_ICQ or U_YIM or U_AIM or U_JABBER --> diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 69b0608a64..ecd993d7fb 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -144,6 +144,7 @@ <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> <dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> <div class="list-inner"> + <!-- EVENT topiclist_row_prepend --> <!-- 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 --> @@ -164,6 +165,7 @@ <!-- ENDIF --> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF -->{L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --> » {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF --> + <!-- EVENT topiclist_row_append --> </div> </dt> <dd class="posts">{topicrow.REPLIES} <dfn>{L_REPLIES}</dfn></dd> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index a8bac42842..0dd4ff220d 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -136,12 +136,14 @@ <!-- 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"> + <!-- EVENT viewtopic_body_post_buttons_before --> <!-- 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}"><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 --> <!-- IF postrow.U_QUOTE --><li class="quote-icon"><a href="{postrow.U_QUOTE}" title="{L_REPLY_WITH_QUOTE}"><span>{L_REPLY_WITH_QUOTE}</span></a></li><!-- ENDIF --> + <!-- EVENT viewtopic_body_post_buttons_after --> </ul> <!-- ENDIF --> <!-- ENDIF --> @@ -237,9 +239,11 @@ <dd><strong>{postrow.PROFILE_FIELD1_NAME}{L_COLON}</strong> {postrow.PROFILE_FIELD1_VALUE}</dd> <!-- ENDIF --> + <!-- EVENT viewtopic_body_postrow_custom_fields_before --> <!-- BEGIN custom_fields --> <dd><strong>{postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON}</strong> {postrow.custom_fields.PROFILE_FIELD_VALUE}</dd> <!-- END custom_fields --> + <!-- EVENT viewtopic_body_postrow_custom_fields_after --> <!-- IF not S_IS_BOT --> <!-- IF postrow.U_PM or postrow.U_EMAIL or postrow.U_WWW or postrow.U_MSN or postrow.U_ICQ or postrow.U_YIM or postrow.U_AIM or postrow.U_JABBER --> @@ -308,17 +312,7 @@ <div class="pagination"> {TOTAL_POSTS} • <!-- IF .pagination --> - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • - <ul> - <!-- BEGIN pagination --> - <!-- IF pagination.S_IS_PREV --> - <!-- ELSEIF pagination.S_IS_CURRENT --><li class="active"><span>{pagination.PAGE_NUMBER}</span></li> - <!-- ELSEIF pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li> - <!-- ELSEIF pagination.S_IS_NEXT --> - <!-- ELSE --><li><a href="{pagination.PAGE_URL}">{pagination.PAGE_NUMBER}</a></li> - <!-- ENDIF --> - <!-- END pagination --> - </ul> + <!-- INCLUDE pagination.html --> <!-- ELSE --> {PAGE_NUMBER} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index f617428565..a921805327 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -422,7 +422,7 @@ margin-left: 0; } -.rtl blockquote dl.codebox { +.rtl blockquote .codebox { margin-right: 0; } diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 7d0462be1b..db55540901 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -77,7 +77,7 @@ hr { } .bg1 { background-color: #ECF3F7; } -.bg2 { background-color: #e1ebf2; } +.bg2 { background-color: #e1ebf2; } .bg3 { background-color: #cadceb; } .ucprowbg { @@ -331,10 +331,10 @@ a.top2 { } /* Arrow links */ -a.arrow-up { background-image: url("./images/arrow_up.gif") } -a.arrow-down { background-image: url("./images/arrow_down.gif") } -a.arrow-left { background-image: url("./images/arrow_left.gif") } -a.arrow-right { background-image: url("./images/arrow_right.gif") } +a.arrow-up { background-image: url("./images/arrow_up.gif"); } +a.arrow-down { background-image: url("./images/arrow_down.gif"); } +a.arrow-left { background-image: url("./images/arrow_left.gif"); } +a.arrow-right { background-image: url("./images/arrow_right.gif"); } a.arrow-up:hover { background-color: transparent; @@ -470,16 +470,16 @@ blockquote blockquote blockquote { } /* Code block */ -dl.codebox { +.codebox { background-color: #FFFFFF; border-color: #C9D2D8; } -dl.codebox dt { +.codebox p { border-bottom-color: #CCCCCC; } -dl.codebox code { +.codebox code { color: #2E8B57; } diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index e58386de45..a2b8034187 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -758,6 +758,10 @@ p.rules a { clear: both; } +#notification_list ul li:before, #notification_list ul li:after { + display: none; +} + #notification_list > .header { padding: 0 10px; font-family: Arial, "Helvetica Neue", Helvetica, Arial, sans-serif; diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 4b8c972697..c56c7f9ef8 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -472,13 +472,13 @@ blockquote.uncited { } /* Code block */ -dl.codebox { +.codebox { padding: 3px; border: 1px solid transparent; font-size: 1em; } -dl.codebox dt { +.codebox p { text-transform: uppercase; border-bottom: 1px solid transparent; margin-bottom: 3px; @@ -487,11 +487,11 @@ dl.codebox dt { display: block; } -blockquote dl.codebox { +blockquote .codebox { margin-left: 0; } -dl.codebox code { +.codebox code { /* Also see tweaks.css */ overflow: auto; display: block; diff --git a/phpBB/styles/prosilver/theme/en/button_pm_forward.gif b/phpBB/styles/prosilver/theme/en/button_pm_forward.gif Binary files differdeleted file mode 100644 index 3384df34be..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_pm_forward.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_pm_new.gif b/phpBB/styles/prosilver/theme/en/button_pm_new.gif Binary files differdeleted file mode 100644 index cc0381c6b2..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_pm_new.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_pm_reply.gif b/phpBB/styles/prosilver/theme/en/button_pm_reply.gif Binary files differdeleted file mode 100644 index 3275b06d52..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_pm_reply.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_topic_locked.gif b/phpBB/styles/prosilver/theme/en/button_topic_locked.gif Binary files differdeleted file mode 100644 index b08918a24f..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_topic_locked.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_topic_new.gif b/phpBB/styles/prosilver/theme/en/button_topic_new.gif Binary files differdeleted file mode 100644 index 5b7b1e0e60..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_topic_new.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/button_topic_reply.gif b/phpBB/styles/prosilver/theme/en/button_topic_reply.gif Binary files differdeleted file mode 100644 index e900c80c70..0000000000 --- a/phpBB/styles/prosilver/theme/en/button_topic_reply.gif +++ /dev/null diff --git a/phpBB/styles/prosilver/theme/en/stylesheet.css b/phpBB/styles/prosilver/theme/en/stylesheet.css index 1a3d0acb4b..82b7df0830 100644 --- a/phpBB/styles/prosilver/theme/en/stylesheet.css +++ b/phpBB/styles/prosilver/theme/en/stylesheet.css @@ -32,33 +32,3 @@ ul.profile-icons li.edit-icon { width: 42px; height: 20px; } padding-left: 58px; padding-top: 58px; } -.imageset.button_pm_forward { - background-image: url("./button_pm_forward.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_pm_new { - background-image: url("./button_pm_new.gif"); - padding-left: 84px; - padding-top: 25px; -} -.imageset.button_pm_reply { - background-image: url("./button_pm_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_locked { - background-image: url("./button_topic_locked.gif"); - padding-left: 88px; - padding-top: 25px; -} -.imageset.button_topic_new { - background-image: url("./button_topic_new.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_reply { - background-image: url("./button_topic_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} diff --git a/phpBB/styles/prosilver/theme/imageset.css b/phpBB/styles/prosilver/theme/imageset.css index 296c617f17..7aa19df06e 100644 --- a/phpBB/styles/prosilver/theme/imageset.css +++ b/phpBB/styles/prosilver/theme/imageset.css @@ -378,33 +378,3 @@ span.imageset { padding-left: 58px; padding-top: 58px; } -.imageset.button_pm_forward { - background-image: url("./en/button_pm_forward.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_pm_new { - background-image: url("./en/button_pm_new.gif"); - padding-left: 84px; - padding-top: 25px; -} -.imageset.button_pm_reply { - background-image: url("./en/button_pm_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_locked { - background-image: url("./en/button_topic_locked.gif"); - padding-left: 88px; - padding-top: 25px; -} -.imageset.button_topic_new { - background-image: url("./en/button_topic_new.gif"); - padding-left: 96px; - padding-top: 25px; -} -.imageset.button_topic_reply { - background-image: url("./en/button_topic_reply.gif"); - padding-left: 96px; - padding-top: 25px; -} diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index bc3ca80fdc..88de620493 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -136,4 +136,4 @@ div.spacer { clear: both; } /* Accessibility tweaks: Mozilla.org */ .skip_link { display: none; } -dl.codebox dt { display: none; } +.codebox p { display: none; } diff --git a/phpBB/styles/subsilver2/template/bbcode.html b/phpBB/styles/subsilver2/template/bbcode.html index efcf5e1acb..5558716cad 100644 --- a/phpBB/styles/subsilver2/template/bbcode.html +++ b/phpBB/styles/subsilver2/template/bbcode.html @@ -21,11 +21,11 @@ <!-- END quote_close --> <!-- BEGIN code_open --> -<div class="codetitle"><b>{L_CODE}{L_COLON}</b></div><div class="codecontent"> +<div class="codetitle"><b>{L_CODE}{L_COLON}</b></div><pre class="codecontent"> <!-- END code_open --> <!-- BEGIN code_close --> -</div> +</pre> <!-- END code_close --> <!-- BEGIN inline_attachment_open --> diff --git a/phpBB/styles/subsilver2/template/memberlist_body.html b/phpBB/styles/subsilver2/template/memberlist_body.html index 09336fb8a3..7c4d301de7 100644 --- a/phpBB/styles/subsilver2/template/memberlist_body.html +++ b/phpBB/styles/subsilver2/template/memberlist_body.html @@ -66,7 +66,7 @@ <!-- IF memberrow.S_ROW_COUNT is even --><tr class="row2"><!-- ELSE --> <tr class="row1"><!-- ENDIF --> <td class="gen" align="center"> {memberrow.ROW_NUMBER} </td> - <td class="genmed" align="{S_CONTENT_FLOW_BEGIN}">{memberrow.USERNAME_FULL}<!-- IF S_SELECT_SINGLE --> [ <a href="#" onclick="insert_single('{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a> ]<!-- ENDIF --></td> + <td class="genmed" align="{S_CONTENT_FLOW_BEGIN}"><!-- EVENT memberlist_body_username_prepend -->{memberrow.USERNAME_FULL}<!-- EVENT memberlist_body_username_append --><!-- IF S_SELECT_SINGLE --> [ <a href="#" onclick="insert_single('{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a> ]<!-- ENDIF --></td> <td class="genmed" align="center" nowrap="nowrap"> {memberrow.JOINED} </td> <td class="gen" align="center">{memberrow.POSTS}</td> <td class="gen" align="center"><!-- IF memberrow.RANK_IMG -->{memberrow.RANK_IMG}<!-- ELSE -->{memberrow.RANK_TITLE}<!-- ENDIF --></td> diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index 464369a7a8..06b5af3322 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -18,7 +18,7 @@ <table cellspacing="1" cellpadding="2" border="0"> <!-- IF S_USER_INACTIVE --> <tr> - <td align="center" style="color: red;"><b class="gen">{L_USER_IS_INACTIVE}</b><br />{L_INACTIVE_REASON}{L_COLON} {USER_INACTIVE_REASON}<br /><br /></td> + <td align="center"><b class="gen inactive">{L_USER_IS_INACTIVE}</b><br />{L_INACTIVE_REASON}{L_COLON} {USER_INACTIVE_REASON}<br /><br /></td> </tr> <!-- ENDIF --> <tr> @@ -66,6 +66,7 @@ </td> <td class="row1"> <table width="100%" cellspacing="1" cellpadding="2" border="0"> + <!-- EVENT memberlist_view_user_statistics_before --> <tr> <td class="gen" align="{S_CONTENT_FLOW_END}" nowrap="nowrap">{L_JOINED}{L_COLON} </td> <td width="100%"><b class="gen">{JOINED}</b></td> @@ -96,6 +97,7 @@ <td><!-- IF ACTIVE_TOPIC != '' --><b><a class="gen" href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></b><br /><span class="genmed">[ {ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT} ]</span><!-- ELSE --><span class="gen">-</span><!-- ENDIF --></td> </tr> <!-- ENDIF --> + <!-- EVENT memberlist_view_user_statistics_after --> </table> </td> </tr> diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index bc2307154b..02ff1be8d8 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -154,8 +154,8 @@ function marklist(id, name, state) <table width="100%" cellspacing="0"> <tr> <td class="genmed"> - <!-- IF S_NOTIFICATIONS_DISPLAY --> - [ <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button">{NOTIFICATIONS_COUNT}</a> ] • + <!-- IF S_NOTIFICATIONS_DISPLAY and not S_IS_BOT and S_USER_LOGGED_IN --> + [ <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button">{NOTIFICATIONS_COUNT}</a> ] <div id="notification_list" class="notification_list"> <div class="row1 header"> {L_NOTIFICATIONS} @@ -196,7 +196,7 @@ function marklist(id, name, state) <!-- ENDIF --> <!-- IF not S_IS_BOT --><a href="{U_LOGIN_LOGOUT}"><img src="{T_THEME_PATH}/images/icon_mini_login.gif" width="12" height="13" alt="*" /> {L_LOGIN_LOGOUT}</a> <!-- ENDIF --> <!-- IF U_RESTORE_PERMISSIONS --> <a href="{U_RESTORE_PERMISSIONS}"><img src="{T_THEME_PATH}/images/icon_mini_login.gif" width="12" height="13" alt="*" /> {L_RESTORE_PERMISSIONS}</a><!-- ENDIF --> - <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --> <span style="color: red;">{L_BOARD_DISABLED}</span><!-- ENDIF --> + <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN --> <span class="error">{L_BOARD_DISABLED}</span><!-- ENDIF --> <!-- IF not S_IS_BOT --> <!-- IF S_USER_LOGGED_IN --> <!-- IF S_DISPLAY_PM --> <a href="{U_PRIVATEMSGS}"><img src="{T_THEME_PATH}/images/icon_mini_message.gif" width="12" height="13" alt="*" /> {PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF --></a><!-- ENDIF --> diff --git a/phpBB/styles/subsilver2/template/posting_smilies.html b/phpBB/styles/subsilver2/template/posting_smilies.html index 30a80e26ab..d0ced9ff12 100644 --- a/phpBB/styles/subsilver2/template/posting_smilies.html +++ b/phpBB/styles/subsilver2/template/posting_smilies.html @@ -2,8 +2,8 @@ <script type="text/javascript"> // <![CDATA[ - var form_name = 'postform'; - var text_name = 'message'; + var form_name = opener.form_name; + var text_name = opener.text_name; // ]]> </script> <script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/editor.js"></script> diff --git a/phpBB/styles/subsilver2/template/search_results.html b/phpBB/styles/subsilver2/template/search_results.html index d98079de20..19ba0b196a 100644 --- a/phpBB/styles/subsilver2/template/search_results.html +++ b/phpBB/styles/subsilver2/template/search_results.html @@ -34,6 +34,7 @@ <!-- ENDIF --> </td> <td class="row1"> + <!-- EVENT topiclist_row_prepend --> <!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF --> {searchresults.ATTACH_ICON_IMG} <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --> @@ -58,6 +59,7 @@ ] </p> <!-- ENDIF --> <p class="gensmall">{L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a></p> + <!-- EVENT topiclist_row_append --> </td> <td class="row2" width="100" align="center"><p class="topicauthor">{searchresults.TOPIC_AUTHOR_FULL}</p></td> <td class="row1" width="50" align="center"><p class="topicdetails">{searchresults.TOPIC_REPLIES}</p></td> diff --git a/phpBB/styles/subsilver2/template/simple_footer.html b/phpBB/styles/subsilver2/template/simple_footer.html index c847bfedcc..48d3d934f8 100644 --- a/phpBB/styles/subsilver2/template/simple_footer.html +++ b/phpBB/styles/subsilver2/template/simple_footer.html @@ -7,8 +7,9 @@ <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 --> -{SCRIPTS} <!-- EVENT simple_footer_after --> + +{$SCRIPTS} </body> </html> diff --git a/phpBB/styles/subsilver2/template/ucp_header.html b/phpBB/styles/subsilver2/template/ucp_header.html index 1ac426d5c3..e3aaef6943 100644 --- a/phpBB/styles/subsilver2/template/ucp_header.html +++ b/phpBB/styles/subsilver2/template/ucp_header.html @@ -123,7 +123,7 @@ <tr> <td class="row1" align="center"> - <b class="genmed" style="color:green">{L_FRIENDS_ONLINE}</b> + <b class="genmed online">{L_FRIENDS_ONLINE}</b> <ul class="nav" style="margin: 0; padding: 0; list-style-type: none; line-height: 175%;"> <!-- BEGIN friends_online --> @@ -139,7 +139,7 @@ <hr /> - <b class="genmed" style="color:red">{L_FRIENDS_OFFLINE}</b> + <b class="genmed offline">{L_FRIENDS_OFFLINE}</b> <ul class="nav" style="margin: 0; padding: 0; list-style-type: none; line-height: 175%;"> <!-- BEGIN friends_offline --> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html index 4f2b627b50..ad06da2b7e 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html @@ -25,7 +25,7 @@ </tr> </table> </td> - <td width="100%"<!-- IF history_row.S_CURRENT_MSG --> style="background-color:lightblue"<!-- ENDIF -->> + <td width="100%"<!-- IF history_row.S_CURRENT_MSG --> class="current"<!-- ENDIF -->> <div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};"><b>{L_PM_SUBJECT}{L_COLON}</b> {history_row.SUBJECT}</div><div class="gensmall" style="float: {S_CONTENT_FLOW_END};"><b>{L_FOLDER}{L_COLON}</b> {history_row.FOLDER}</div> </td> </tr> diff --git a/phpBB/styles/subsilver2/template/ucp_profile_signature.html b/phpBB/styles/subsilver2/template/ucp_profile_signature.html index 467018dd1c..85c8b0f616 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_signature.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_signature.html @@ -1,13 +1,22 @@ <!-- INCLUDE ucp_header.html --> +<script type="text/javascript"> +// <![CDATA[ + var form_name = 'ucp'; + var text_name = 'signature'; +// ]]> +</script> + <!-- DEFINE $S_SIGNATURE = 1 --> <table class="tablebg" width="100%" cellspacing="1"> <tr> <th colspan="2">{L_TITLE}</th> </tr> +<!-- IF not S_SMILIES_ALLOWED --> <tr> <td colspan="2" class="row1">{L_SIGNATURE_EXPLAIN}</td> </tr> +<!-- ENDIF --> <!-- IF ERROR --> <tr> @@ -16,14 +25,32 @@ <!-- ENDIF --> <tr> - <td colspan="2" class="row2"> - <script type="text/javascript"> - // <![CDATA[ - var form_name = 'ucp'; - var text_name = 'signature'; - // ]]> - </script> - + <!-- IF S_SMILIES_ALLOWED --> + <td class="row1" width="22%" valign="top"> + {L_SIGNATURE_EXPLAIN} + <table width="100%" cellspacing="5" cellpadding="0" border="0" align="center"> + <tr> + <td class="gensmall" align="center"><b>{L_SMILIES}</b></td> + </tr> + <tr> + <td align="center"> + <!-- BEGIN smiley --> + <a href="#" onclick="insert_text('{smiley.A_SMILEY_CODE}', true); return false;" style="line-height: 20px;"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" hspace="2" vspace="2" /></a> + <!-- END smiley --> + </td> + </tr> + <!-- IF S_SHOW_SMILEY_LINK --> + <tr> + <td align="center"><a class="nav" href="{U_MORE_SMILIES}" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a></td> + </tr> + <!-- ENDIF --> + </table> + </td> + <td class="row2"> + <!-- ELSE --> + <td class="row2" colspan="2"> + <!-- ENDIF --> + <table cellspacing="0" cellpadding="2" border="0" width="99%"> <!-- INCLUDE posting_buttons.html --> <tr> diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html index d07e9a1372..dfbe0a605b 100644 --- a/phpBB/styles/subsilver2/template/viewforum_body.html +++ b/phpBB/styles/subsilver2/template/viewforum_body.html @@ -40,6 +40,7 @@ <td class="row1" width="25" align="center"><!-- IF topicrow.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td> <!-- ENDIF --> <td class="row1"> + <!-- EVENT topiclist_row_prepend --> <!-- 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 --> @@ -63,6 +64,7 @@ <!-- END pagination --> ] </p> <!-- ENDIF --> + <!-- EVENT topiclist_row_append --> </td> <td class="row2" width="130" align="center"><p class="topicauthor">{topicrow.TOPIC_AUTHOR_FULL}</p></td> <td class="row1" width="50" align="center"><p class="topicdetails">{topicrow.REPLIES}</p></td> @@ -203,6 +205,7 @@ <td class="row1" width="25" align="center"><!-- IF topicrow.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td> <!-- ENDIF --> <td class="row1"> + <!-- EVENT topiclist_row_prepend --> <!-- 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 --> @@ -227,6 +230,7 @@ ] </p> <!-- ENDIF --> <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --><p class="gensmall">{L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a></p><!-- ENDIF --> + <!-- EVENT topiclist_row_append --> </td> <td class="row2" width="130" align="center"><p class="topicauthor">{topicrow.TOPIC_AUTHOR_FULL}</p></td> <td class="row1" width="50" align="center"><p class="topicdetails">{topicrow.REPLIES}</p></td> diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 299b8219eb..26e74b8c38 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -208,9 +208,11 @@ <br /><b>{postrow.PROFILE_FIELD1_NAME}{L_COLON}</b> {postrow.PROFILE_FIELD1_VALUE} <!-- ENDIF --> + <!-- EVENT viewtopic_body_postrow_custom_fields_before --> <!-- BEGIN custom_fields --> <br /><b>{postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON}</b> {postrow.custom_fields.PROFILE_FIELD_VALUE} <!-- END custom_fields --> + <!-- EVENT viewtopic_body_postrow_custom_fields_after --> </span> </td> @@ -315,7 +317,21 @@ <!-- IF postrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> <td class="profile"><strong><a href="#wrapheader">{L_BACK_TO_TOP}</a></strong></td> - <td><div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};"> <!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}" class="imageset">{PROFILE_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_PM --><a href="{postrow.U_PM}" class="imageset">{PM_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_EMAIL --><a href="{postrow.U_EMAIL}" class="imageset">{EMAIL_IMG}</a> <!-- ENDIF --> </div> <div class="gensmall" style="float: {S_CONTENT_FLOW_END};"><!-- IF not S_IS_BOT --><!-- IF postrow.U_EDIT --><a href="{postrow.U_EDIT}" class="imageset">{EDIT_IMG}</a> <!-- ENDIF --> <!-- IF postrow.U_QUOTE --><a href="{postrow.U_QUOTE}" class="imageset">{QUOTE_IMG}</a> <!-- ENDIF --> <!-- ENDIF --> </div></td> + <td> + <div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};"> + <!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}" class="imageset">{PROFILE_IMG}</a><!-- ENDIF --> + <!-- IF postrow.U_PM --><a href="{postrow.U_PM}" class="imageset">{PM_IMG}</a><!-- ENDIF --> + <!-- IF postrow.U_EMAIL --><a href="{postrow.U_EMAIL}" class="imageset">{EMAIL_IMG}</a><!-- ENDIF --> + </div> + <div class="gensmall" style="float: {S_CONTENT_FLOW_END};"> + <!-- EVENT viewtopic_body_post_buttons_before --> + <!-- IF not S_IS_BOT --> + <!-- IF postrow.U_EDIT --><a href="{postrow.U_EDIT}" class="imageset">{EDIT_IMG}</a><!-- ENDIF --> + <!-- IF postrow.U_QUOTE --><a href="{postrow.U_QUOTE}" class="imageset">{QUOTE_IMG}</a><!-- ENDIF --> + <!-- ENDIF --> + <!-- EVENT viewtopic_body_post_buttons_after --> + </div> + </td> <!-- ENDIF --> </tr> diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css index bfb80a53b5..d2352d93ef 100644 --- a/phpBB/styles/subsilver2/theme/stylesheet.css +++ b/phpBB/styles/subsilver2/theme/stylesheet.css @@ -292,7 +292,11 @@ p.topicdetails { text-decoration: none; } -.error { +.online { + color: green; +} + +.offline, .error, .inactive { color: red; } @@ -360,6 +364,10 @@ td.profile { background-color: #D1D7DC; } +.current { + background-color: lightblue; +} + hr { height: 1px; border-width: 0; diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 06af674ee6..1fa2030671 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); } @@ -372,6 +372,16 @@ $sql_array = array( 'LEFT_JOIN' => array(), ); +/** +* Event to modify the SQL query before the topic data is retrieved +* +* @event core.viewforum_get_topic_data +* @var array sql_array The SQL array to get the data of all topics +* @since 3.1-A1 +*/ +$vars = array('sql_array'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_data', compact($vars))); + $sql_approved = ' AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'); if ($user->data['is_registered']) @@ -554,6 +564,17 @@ if (sizeof($shadow_topic_list)) $sql = 'SELECT * FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', array_keys($shadow_topic_list)); + + /** + * Event to modify the SQL query before the shadowtopic data is retrieved + * + * @event core.viewforum_get_shadowtopic_data + * @var string sql The SQL string to get the data of any shadowtopics + * @since 3.1-A1 + */ + $vars = array('sql'); + extract($phpbb_dispatcher->trigger_event('core.viewforum_get_shadowtopic_data', compact($vars))); + $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 1e444f47ad..bc54a249a9 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -832,39 +832,14 @@ if (!empty($topic_data['poll_start'])) $poll_total += $poll_option['poll_option_total']; } - if ($poll_info[0]['bbcode_bitfield']) - { - $poll_bbcode = new bbcode(); - } - else - { - $poll_bbcode = false; - } + $parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) { - $poll_info[$i]['poll_option_text'] = censor_text($poll_info[$i]['poll_option_text']); - - if ($poll_bbcode !== false) - { - $poll_bbcode->bbcode_second_pass($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield']); - } - - $poll_info[$i]['poll_option_text'] = bbcode_nl2br($poll_info[$i]['poll_option_text']); - $poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']); - } - - $topic_data['poll_title'] = censor_text($topic_data['poll_title']); - - if ($poll_bbcode !== false) - { - $poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']); + $poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_flags, true); } - $topic_data['poll_title'] = bbcode_nl2br($topic_data['poll_title']); - $topic_data['poll_title'] = smiley_text($topic_data['poll_title']); - - unset($poll_bbcode); + $topic_data['poll_title'] = generate_text_for_display($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield'], $parse_flags, true); foreach ($poll_info as $poll_option) { @@ -1406,29 +1381,13 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // End signature parsing, only if needed if ($user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) { - $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']); - - if ($user_cache[$poster_id]['sig_bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield']); - } - - $user_cache[$poster_id]['sig'] = bbcode_nl2br($user_cache[$poster_id]['sig']); - $user_cache[$poster_id]['sig'] = smiley_text($user_cache[$poster_id]['sig']); - $user_cache[$poster_id]['sig_parsed'] = true; + $parse_flags = ($user_cache[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $user_cache[$poster_id]['sig'] = generate_text_for_display($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield'], $parse_flags, true); } // Parse the message and subject - $message = censor_text($row['post_text']); - - // Second parse bbcode here - if ($row['bbcode_bitfield']) - { - $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); - } - - $message = bbcode_nl2br($message); - $message = smiley_text($message); + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true); if (!empty($attachments[$row['post_id']])) { diff --git a/phpunit.xml.all b/phpunit.xml.all index d47864e104..d18518d3e3 100644 --- a/phpunit.xml.all +++ b/phpunit.xml.all @@ -27,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 ac45597b45..c852f91b50 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -34,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 3a3d653b47..cd9cc8771f 100644 --- a/phpunit.xml.functional +++ b/phpunit.xml.functional @@ -33,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/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/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 6686b77e8f..fc7d02e9cf 100644 --- a/tests/controller/helper_url_test.php +++ b/tests/controller/helper_url_test.php @@ -48,12 +48,8 @@ class phpbb_controller_helper_url_test extends phpbb_test_case 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_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/di/create_container_test.php b/tests/di/create_container_test.php index b3992dbd80..c570f19ebd 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -17,7 +17,7 @@ class phpbb_di_container_test extends phpbb_test_case $phpbb_root_path = __DIR__ . '/../../phpBB/'; $extensions = array( new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ); $container = phpbb_create_container($extensions, $phpbb_root_path, 'php'); @@ -29,7 +29,7 @@ class phpbb_di_container_test extends phpbb_test_case $phpbb_root_path = __DIR__ . '/../../phpBB/'; $extensions = array( new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), - new phpbb_di_extension_core($phpbb_root_path), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ); $container = phpbb_create_install_container($phpbb_root_path, 'php'); @@ -43,7 +43,7 @@ class phpbb_di_container_test extends phpbb_test_case $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), + new phpbb_di_extension_core($phpbb_root_path . 'config'), ); $container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php'); diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index d67dea3719..fceb8aa3d8 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -8,7 +8,6 @@ */ require_once dirname(__FILE__) . '/../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../phpBB/includes/error_collector.php'; class phpbb_error_collector_test extends phpbb_test_case { diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 6f3cebbd7c..3bf2c42573 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -36,7 +36,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_suffix_get_classes() { $classes = $this->finder - ->core_path('includes/default/') + ->core_path('phpbb/default/') ->extension_suffix('_class') ->get_classes(); @@ -81,7 +81,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_prefix_get_classes() { $classes = $this->finder - ->core_path('includes/default/') + ->core_path('phpbb/default/') ->extension_prefix('hidden_') ->get_classes(); @@ -98,7 +98,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_directory_get_classes() { $classes = $this->finder - ->core_path('includes/default/') + ->core_path('phpbb/default/') ->extension_directory('type') ->get_classes(); @@ -209,7 +209,7 @@ class phpbb_extension_finder_test extends phpbb_test_case public function test_cached_get_files() { $query = array( - 'core_path' => 'includes/foo', + 'core_path' => 'phpbb/foo', 'core_suffix' => false, 'core_prefix' => false, 'core_directory' => 'bar', diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index bd88f396d9..e5bd29092e 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -7,8 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; - class phpbb_extension_metadata_manager_test extends phpbb_database_test_case { protected $class_loader; diff --git a/tests/extension/includes/default/implementation.php b/tests/extension/phpbb/default/implementation.php index 91d5f8aa2f..91d5f8aa2f 100644 --- a/tests/extension/includes/default/implementation.php +++ b/tests/extension/phpbb/default/implementation.php diff --git a/tests/extension/style_path_provider_test.php b/tests/extension/style_path_provider_test.php deleted file mode 100644 index e1021c20ac..0000000000 --- a/tests/extension/style_path_provider_test.php +++ /dev/null @@ -1,50 +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__) . '/../../phpBB/includes/functions.php'; - -class phpbb_extension_style_path_provider_test extends phpbb_test_case -{ - protected $relative_root_path; - protected $root_path; - - public function setUp() - { - $this->relative_root_path = './'; - $this->root_path = dirname(__FILE__) . '/'; - } - - public function test_find() - { - $phpbb_style_path_provider = new phpbb_style_path_provider(); - $phpbb_style_path_provider->set_styles(array($this->relative_root_path . 'styles/prosilver')); - $phpbb_style_extension_path_provider = new phpbb_style_extension_path_provider(new phpbb_mock_extension_manager( - $this->root_path, - array( - 'foo' => array( - 'ext_name' => 'foo', - 'ext_active' => '1', - 'ext_path' => 'ext/foo/', - ), - 'bar' => array( - 'ext_name' => 'bar', - 'ext_active' => '1', - 'ext_path' => 'ext/bar/', - ), - )), $phpbb_style_path_provider, $this->relative_root_path); - - $this->assertEquals(array( - 'style' => array( - $this->relative_root_path . 'styles/prosilver', - ), - 'bar' => array( - $this->root_path . 'ext/bar/styles/prosilver', - ), - ), $phpbb_style_extension_path_provider->find()); - } -} diff --git a/tests/extension/subdir/style_path_provider_test.php b/tests/extension/subdir/style_path_provider_test.php deleted file mode 100644 index 1b5ce62e5f..0000000000 --- a/tests/extension/subdir/style_path_provider_test.php +++ /dev/null @@ -1,18 +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__) . '/../style_path_provider_test.php'; - -class phpbb_extension_subdir_style_path_provider_test extends phpbb_extension_style_path_provider_test -{ - public function setUp() - { - $this->relative_root_path = '../'; - $this->root_path = dirname(__FILE__) . '/../'; - } -} diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php new file mode 100644 index 0000000000..9fdc29cc76 --- /dev/null +++ b/tests/functional/avatar_acp_groups_test.php @@ -0,0 +1,63 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/common_avatar_test.php'; + +/** + * @group functional + */ +class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_avatar_test +{ + public function get_url() + { + return 'adm/index.php?i=acp_groups&mode=manage&action=edit&g=5'; + } + + public function avatar_acp_groups_data() + { + return array( + // Correct Gravatar + array( + 'GROUP_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test@example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Gravatar with incorrect size + array( + 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test@example.com', + 'avatar_gravatar_width' => 120, + 'avatar_gravatar_height' => 120, + ), + ), + // Delete avatar image to reset group settings + array( + 'GROUP_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_delete' => array('tick', ''), + ), + ), + ); + } + + /** + * @dataProvider avatar_acp_groups_data + */ + public function test_avatar_acp_groups($expected, $avatar_type, $data) + { + $this->assert_avatar_submit($expected, $avatar_type, $data); + } +} diff --git a/tests/functional/avatar_acp_users_test.php b/tests/functional/avatar_acp_users_test.php new file mode 100644 index 0000000000..0afd05e530 --- /dev/null +++ b/tests/functional/avatar_acp_users_test.php @@ -0,0 +1,61 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/common_avatar_test.php'; + +/** + * @group functional + */ +class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_avatar_test +{ + public function get_url() + { + return 'adm/index.php?i=acp_users&u=2&mode=avatar'; + } + + public function avatar_acp_users_data() + { + return array( + // Gravatar with incorrect email + array( + 'EMAIL_INVALID_EMAIL', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test.example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Remote avatar with correct link + array( + 'USER_AVATAR_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + ), + ), + // Reset avatar settings + array( + 'USER_AVATAR_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_delete' => array('tick', ''), + ), + ), + ); + } + + /** + * @dataProvider avatar_acp_users_data + */ + public function test_avatar_acp_users($expected, $avatar_type, $data) + { + $this->assert_avatar_submit($expected, $avatar_type, $data); + } +} diff --git a/tests/functional/avatar_ucp_groups_test.php b/tests/functional/avatar_ucp_groups_test.php new file mode 100644 index 0000000000..233b7d36e1 --- /dev/null +++ b/tests/functional/avatar_ucp_groups_test.php @@ -0,0 +1,71 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/common_avatar_test.php'; + +/** + * @group functional + */ +class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_avatar_test +{ + public function get_url() + { + return 'ucp.php?i=ucp_groups&mode=manage&action=edit&g=5'; + } + + public function avatar_ucp_groups_data() + { + return array( + // Incorrect URL + array( + 'AVATAR_URL_INVALID', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=80', + ), + ), + /* + // Does not work due to DomCrawler issue + // Valid file upload + array( + 'GROUP_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_file' => array('upload', $this->path . 'valid.jpg'), + ), + ), + */ + // Correct remote avatar + array( + 'GROUP_UPDATED', + 'avatar_driver_remote', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + array( + 'GROUP_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_delete' => array('tick', ''), + ), + ), + ); + } + + /** + * @dataProvider avatar_ucp_groups_data + */ + public function test_avatar_ucp_groups($expected, $avatar_type, $data) + { + $this->assert_avatar_submit($expected, $avatar_type, $data); + } +} diff --git a/tests/functional/avatar_ucp_users_test.php b/tests/functional/avatar_ucp_users_test.php new file mode 100644 index 0000000000..f828559e0d --- /dev/null +++ b/tests/functional/avatar_ucp_users_test.php @@ -0,0 +1,78 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/common_avatar_test.php'; + +/** + * @group functional + */ +class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_avatar_test +{ + public function get_url() + { + return 'ucp.php?i=ucp_profile&mode=avatar'; + } + + public function avatar_ucp_groups_data() + { + return array( + // Gravatar with correct settings + array( + 'PROFILE_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_gravatar_email' => 'test@example.com', + 'avatar_gravatar_width' => 80, + 'avatar_gravatar_height' => 80, + ), + ), + // Wrong driver selected + array( + 'NO_AVATAR_SELECTED', + 'avatar_driver_upload', + array( + 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + 'avatar_remote_width' => 80, + 'avatar_remote_height' => 80, + ), + ), + array( + 'PROFILE_UPDATED', + 'avatar_driver_gravatar', + array( + 'avatar_delete' => array('tick', ''), + ), + ), + ); + } + + /** + * @dataProvider avatar_ucp_groups_data + */ + public function test_avatar_ucp_groups($expected, $avatar_type, $data) + { + $this->assert_avatar_submit($expected, $avatar_type, $data); + } + + public function test_display_upload_avatar() + { + $this->assert_avatar_submit('PROFILE_UPDATED', + 'avatar_driver_upload', + array( + 'avatar_upload_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', + ) + ); + + $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid); + $avatar_link = $crawler->filter('img')->attr('src'); + $crawler = self::request('GET', $avatar_link . '&sid=' . $this->sid, array(), false); + $content = self::$client->getResponse()->getContent(); + self::assertEquals(false, stripos(trim($content), 'debug'), 'Output contains debug message'); + } +} diff --git a/tests/functional/browse_test.php b/tests/functional/browse_test.php index 18a2ad9464..c3be301762 100644 --- a/tests/functional/browse_test.php +++ b/tests/functional/browse_test.php @@ -29,4 +29,11 @@ class phpbb_functional_browse_test extends phpbb_functional_test_case $crawler = self::request('GET', 'viewtopic.php?t=1'); $this->assertGreaterThan(0, $crawler->filter('.postbody')->count()); } + + public function test_feed() + { + $crawler = self::request('GET', 'feed.php', array(), false); + self::assert_response_xml(); + $this->assertGreaterThan(0, $crawler->filter('entry')->count()); + } } diff --git a/tests/functional/common_avatar_test.php b/tests/functional/common_avatar_test.php new file mode 100644 index 0000000000..c0f21d07c2 --- /dev/null +++ b/tests/functional/common_avatar_test.php @@ -0,0 +1,80 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +/** + * @group functional + */ +abstract class phpbb_functional_common_avatar_test extends phpbb_functional_test_case +{ + private $path; + private $form_content; + + abstract function get_url(); + + public function setUp() + { + parent::setUp(); + $this->path = __DIR__ . '/fixtures/files/'; + $this->login(); + $this->admin_login(); + $this->add_lang(array('acp/board', 'ucp', 'acp/users', 'acp/groups')); + $this->set_acp_settings(); + } + + private function set_acp_settings() + { + $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid); + // Check the default entries we should have + $this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text()); + $this->assertContainsLang('ALLOW_REMOTE', $crawler->text()); + $this->assertContainsLang('ALLOW_AVATARS', $crawler->text()); + $this->assertContainsLang('ALLOW_LOCAL', $crawler->text()); + + // Now start setting the needed settings + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $form['config[allow_avatar_local]']->select(1); + $form['config[allow_avatar_gravatar]']->select(1); + $form['config[allow_avatar_remote]']->select(1); + $form['config[allow_avatar_remote_upload]']->select(1); + $crawler = self::submit($form); + $this->assertContainsLang('CONFIG_UPDATED', $crawler->text()); + } + + public function assert_avatar_submit($expected, $type, $data, $button_text = 'SUBMIT') + { + $crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid); + + // Test if setting a gravatar avatar properly works + $form = $crawler->selectButton($this->lang($button_text))->form(); + $form['avatar_driver']->select($type); + + foreach ($data as $key => $value) + { + if (is_array($value)) + { + $form[$key]->$value[0]($value[1]); + } + else + { + $form[$key]->setValue($value); + } + } + + $crawler = self::submit($form); + + try + { + $this->assertContainsLang($expected, $crawler->text()); + } + catch (Exception $e) + { + $this->assertContains($expected, $crawler->text()); + } + } +} diff --git a/tests/functional/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_global_lang_test.php b/tests/functional/extension_global_lang_test.php new file mode 100644 index 0000000000..fb8f87e6de --- /dev/null +++ b/tests/functional/extension_global_lang_test.php @@ -0,0 +1,63 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @group functional +*/ +class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_case +{ + protected $phpbb_extension_manager; + + static private $helper; + + static protected $fixtures = array( + 'foo/bar/language/en/', + 'foo/bar/event/', + ); + + static public function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + self::$helper = new phpbb_test_case_helpers(self); + self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); + } + + static public function tearDownAfterClass() + { + parent::tearDownAfterClass(); + + self::$helper->restore_original_ext_dir(); + } + + public function setUp() + { + parent::setUp(); + + $this->get_db(); + + $this->phpbb_extension_manager = $this->get_extension_manager(); + + $this->purge_cache(); + } + + public function test_load_extension_lang_globally() + { + $this->phpbb_extension_manager->enable('foo/bar'); + + // The board index, which should contain an overwritten translation + $crawler = self::request('GET', 'index.php'); + + // language from language/en/common.php + $this->assertNotContains('Skip to content', $crawler->filter('.skiplink')->text()); + + // language from ext/foo/bar/language/en/foo_global.php + $this->assertContains('Overwritten by foo', $crawler->filter('.skiplink')->text()); + } +} diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php index c573ea5410..c31a892ce9 100644 --- a/tests/functional/extension_module_test.php +++ b/tests/functional/extension_module_test.php @@ -6,8 +6,6 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ - -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_modules.php'; /** diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php index 6c1720735c..19adb89819 100644 --- a/tests/functional/extension_permission_lang_test.php +++ b/tests/functional/extension_permission_lang_test.php @@ -18,6 +18,7 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t static protected $fixtures = array( 'foo/bar/language/en/', + 'foo/bar/event/', ); static public function setUpBeforeClass() @@ -75,6 +76,6 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t $this->assertContains('Can attach files', $crawler->filter('body')->text()); // language from ext/foo/bar/language/en/permissions_foo.php - $this->assertContains('Can view foo', $crawler->filter('body')->text()); + $this->assertContains('Can view foobar', $crawler->filter('body')->text()); } } diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index 8e361ab77b..65c4b6b7c4 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -44,14 +44,14 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case public function test_invalid_extension() { $upload = new fileupload('', array('jpg'), 100); - $file = $upload->remote_upload('http://example.com/image.gif'); + $file = $upload->remote_upload(self::$root_url . 'develop/blank.gif'); $this->assertEquals('URL_INVALID', $file->error[0]); } - public function test_non_existant() + public function test_empty_file() { $upload = new fileupload('', array('jpg'), 100); - $file = $upload->remote_upload('http://example.com/image.jpg'); + $file = $upload->remote_upload(self::$root_url . 'develop/blank.jpg'); $this->assertEquals('EMPTY_REMOTE_DATA', $file->error[0]); } diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission.php b/tests/functional/fixtures/ext/foo/bar/event/permission.php new file mode 100644 index 0000000000..48688a586a --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/event/permission.php @@ -0,0 +1,40 @@ +<?php + +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ + +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Event listener +*/ +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +class phpbb_ext_foo_bar_event_permission implements EventSubscriberInterface +{ + static public function getSubscribedEvents() + { + return array( + 'core.permissions' => 'add_permissions', + ); + } + + public function add_permissions($event) + { + $permissions = $event['permissions']; + $permissions['u_foo'] = array('lang' => 'ACL_U_FOOBAR', 'cat' => 'post'); + $event['permissions'] = $permissions; + } +} diff --git a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php new file mode 100644 index 0000000000..3d2d0c5325 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php @@ -0,0 +1,43 @@ +<?php + +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ + +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Event listener +*/ +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +class phpbb_ext_foo_bar_event_user_setup implements EventSubscriberInterface +{ + static public function getSubscribedEvents() + { + return array( + 'core.user_setup' => 'add_global_translations', + ); + } + + public function add_global_translations($event) + { + $lang_set_ext = $event['lang_set_ext']; + $lang_set_ext[] = array( + 'ext_name' => 'foo/bar', + 'lang_set' => 'foo_global', + ); + $event['lang_set_ext'] = $lang_set_ext; + } +} diff --git a/tests/functional/fixtures/ext/foo/bar/language/en/foo_global.php b/tests/functional/fixtures/ext/foo/bar/language/en/foo_global.php new file mode 100644 index 0000000000..a6af8680d3 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/language/en/foo_global.php @@ -0,0 +1,5 @@ +<?php + +$lang = array_merge($lang, array( + 'SKIP' => 'Overwritten by foo', +)); diff --git a/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php b/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php index cd4b9a32d1..64b497c394 100644 --- a/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php +++ b/tests/functional/fixtures/ext/foo/bar/language/en/permissions_foo.php @@ -1,6 +1,5 @@ <?php -// Admin Permissions $lang = array_merge($lang, array( - 'acl_u_foo' => array('lang' => 'Can view foo', 'cat' => 'misc'), + 'ACL_U_FOOBAR' => 'Can view foobar with permission foo', )); diff --git a/tests/functional/mcp_test.php b/tests/functional/mcp_test.php new file mode 100644 index 0000000000..f65a7d0784 --- /dev/null +++ b/tests/functional/mcp_test.php @@ -0,0 +1,67 @@ +<?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_mcp_test extends phpbb_functional_test_case +{ + public function test_post_new_topic() + { + $this->login(); + + // Test creating topic + $post = $this->create_topic(2, 'Test Topic 2', 'Testing move post with "Move posts" option from Quick-Moderator Tools.'); + + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertContains('Testing move post with "Move posts" option from Quick-Moderator Tools.', $crawler->filter('html')->text()); + + return $crawler; + } + + /** + * @depends test_post_new_topic + */ + public function test_handle_quickmod($crawler) + { + // Test moving a post + $form = $crawler->selectButton('Go')->eq(1)->form(); + $form['action']->select('merge'); + $crawler = self::submit($form); + + return $crawler; + } + + /** + * @depends test_handle_quickmod + */ + public function test_move_post_to_topic($crawler) + { + // Select the post in MCP + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(array( + 'to_topic_id' => 1, + )); + $form['post_id_list'][0]->tick(); + $crawler = self::submit($form); + $this->assertContains($this->lang('MERGE_POSTS'), $crawler->filter('html')->text()); + + return $crawler; + } + + /** + * @depends test_move_post_to_topic + */ + public function test_confirm_result($crawler) + { + $this->add_lang('mcp'); + $form = $crawler->selectButton('Yes')->form(); + $crawler = self::submit($form); + $this->assertContains($this->lang('POSTS_MERGED_SUCCESS'), $crawler->text()); + } +} diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php index c55e7373ea..651c99a99d 100644 --- a/tests/functional/metadata_manager_test.php +++ b/tests/functional/metadata_manager_test.php @@ -7,8 +7,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; - /** * @group functional */ diff --git a/tests/functional/report_post_captcha.php b/tests/functional/report_post_captcha_test.php index af713775c5..8283465041 100644 --- a/tests/functional/report_post_captcha.php +++ b/tests/functional/report_post_captcha_test.php @@ -12,13 +12,6 @@ */ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_case { - public function test_user_report_post() - { - $this->login(); - $crawler = self::request('GET', 'report.php?f=2&p=1'); - $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); - } - public function test_guest_report_post() { $crawler = self::request('GET', 'report.php?f=2&p=1'); @@ -31,6 +24,18 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca $this->set_reporting_guest(-1); } + public function test_user_report_post() + { + $this->login(); + $crawler = self::request('GET', 'report.php?f=2&p=1'); + $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); + + $this->add_lang('mcp'); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $crawler = self::submit($form); + $this->assertContains($this->lang('POST_REPORTED_SUCCESS'), $crawler->text()); + } + protected function set_reporting_guest($report_post_allowed) { $this->login(); diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index 1ab9488568..6827aaa1b6 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -11,7 +11,6 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_admin.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; require_once dirname(__FILE__) . '/../mock/user.php'; require_once dirname(__FILE__) . '/../mock/cache.php'; diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php new file mode 100644 index 0000000000..9d002334d6 --- /dev/null +++ b/tests/mock/auth_provider.php @@ -0,0 +1,53 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +/** + * Mock auth provider class with basic functions to help test sessions. + */ +class phpbb_mock_auth_provider implements phpbb_auth_provider_interface +{ + function init() + { + return null; + } + + function login($username, $password) + { + return array( + 'status' => "", + 'error_msg' => "", + 'user_row' => "", + ); + } + + function autologin() + { + return array(); + } + + function acp() + { + return array(); + } + + function logout($data, $new_session) + { + return null; + } + + function validate_session($user) + { + return null; + } + + public function get_acp_template($new_config) + { + return null; + } +} diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php index 56ff8c8b32..283f9af192 100644 --- a/tests/mock/session_testable.php +++ b/tests/mock/session_testable.php @@ -58,5 +58,9 @@ class phpbb_mock_session_testable extends phpbb_session } } } + + public function setup() + { + } } diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index 4d00fa0a1e..c038020385 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_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__) . '/../mock/sql_insert_buffer.php'; class phpbb_notification_convert_test extends phpbb_database_test_case diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php new file mode 100644 index 0000000000..8d6c9a866d --- /dev/null +++ b/tests/session/check_ban_test.php @@ -0,0 +1,78 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; + +class phpbb_session_check_ban_test extends phpbb_session_test_case +{ + protected $user_id = 4; + protected $key_id = 4; + protected $session; + protected $backup_cache; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_banlist.xml'); + } + + static function check_banned_data() + { + return array( + array('All false values, should not be banned', + false, false, false, false, /* should be banned? -> */ false), + array('Matching values in the database, should be banned', + 4, '127.0.0.1', 'bar@example.org', true, /* should be banned? -> */ true), + array('IP Banned, should be banned', + false, '127.1.1.1', false, false, /* should be banned? -> */ true), + ); + } + + public function setUp() + { + parent::setUp(); + // Get session here so that config is mocked correctly + $this->session = $this->session_factory->get_session($this->db); + global $cache, $config, $phpbb_root_path, $phpEx; + $this->backup_cache = $cache; + // Change the global cache object for this test because + // the mock cache object does not hit the database as is needed + // for this test. + $cache = new phpbb_cache_service( + new phpbb_cache_driver_file(), + $config, + $this->db, + $phpbb_root_path, + $phpEx + ); + } + + public function tearDown() + { + parent::tearDown(); + // Set cache back to what it was before the test changed it + global $cache; + $cache = $this->backup_cache; + } + + /** @dataProvider check_banned_data */ + public function test_check_is_banned($test_msg, $user_id, $user_ips, $user_email, $return, $should_be_banned) + { + try + { + $is_banned = $this->session->check_ban($user_id, $user_ips, $user_email, $return); + } + catch (PHPUnit_Framework_Error_Notice $e) + { + // User error was triggered, user must have been banned + $is_banned = true; + } + + $this->assertEquals($should_be_banned, $is_banned, $test_msg); + } +} diff --git a/tests/session/check_isvalid_test.php b/tests/session/check_isvalid_test.php new file mode 100644 index 0000000000..760e2a6f24 --- /dev/null +++ b/tests/session/check_isvalid_test.php @@ -0,0 +1,61 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; + +class phpbb_session_check_isvalid_test extends phpbb_session_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml'); + } + + protected function access_with($session_id, $user_id, $user_agent, $ip) + { + $this->session_factory->merge_test_data($session_id, $user_id, $user_agent, $ip); + + $session = $this->session_factory->get_session($this->db); + $session->page = array('page' => 'page', 'forum' => 0); + + $session->session_begin(); + $this->session_factory->check($this); + return $session; + } + + public function test_session_valid_session_exists() + { + $session = $this->access_with('bar_session000000000000000000000', '4', 'user agent', '127.0.0.1'); + $session->check_cookies($this, array()); + + $this->check_sessions_equals(array( + array('session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1), + array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), + ), + 'If a request comes with a valid session id with matching user agent and IP, no new session should be created.' + ); + } + + public function test_session_invalid_make_new_annon_session() + { + $session = $this->access_with('anon_session00000000000000000000', '4', 'user agent', '127.0.0.1'); + $session->check_cookies($this, array( + 'u' => array('1', null), + 'k' => array(null, null), + 'sid' => array($session->session_id, null), + )); + + $this->check_sessions_equals(array( + array('session_id' => $session->session_id, 'session_user_id' => 1), // use generated SID + array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), + ), + 'If a request comes with a valid session id and IP but different user id and user agent, + a new anonymous session is created and the session matching the supplied session id is deleted.' + ); + } +} diff --git a/tests/session/continue_test.php b/tests/session/continue_test.php deleted file mode 100644 index e5a7f7a4a1..0000000000 --- a/tests/session/continue_test.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -require_once dirname(__FILE__) . '/testable_factory.php'; - -class phpbb_session_continue_test extends phpbb_database_test_case -{ - public function getDataSet() - { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml'); - } - - static public function session_begin_attempts() - { - // The session_id field is defined as CHAR(32) in the database schema. - // Thus the data we put in session_id fields has to have a length of 32 characters on stricter DBMSes. - // Thus we fill those strings up with zeroes until they have a string length of 32. - - return array( - array( - 'bar_session000000000000000000000', '4', 'user agent', '127.0.0.1', - array( - array('session_id' => 'anon_session00000000000000000000', 'session_user_id' => 1), - array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), - ), - array(), - 'If a request comes with a valid session id with matching user agent and IP, no new session should be created.', - ), - array( - 'anon_session00000000000000000000', '4', 'user agent', '127.0.0.1', - array( - array('session_id' => '__new_session_id__', 'session_user_id' => 1), // use generated SID - array('session_id' => 'bar_session000000000000000000000', 'session_user_id' => 4), - ), - array( - 'u' => array('1', null), - 'k' => array(null, null), - 'sid' => array('__new_session_id__', null), - ), - 'If a request comes with a valid session id and IP but different user id and user agent, a new anonymous session is created and the session matching the supplied session id is deleted.', - ), - ); - } - - /** - * @dataProvider session_begin_attempts - */ - public function test_session_begin_valid_session($session_id, $user_id, $user_agent, $ip, $expected_sessions, $expected_cookies, $message) - { - global $phpbb_container, $phpbb_root_path, $phpEx; - - $db = $this->new_dbal(); - $config = new phpbb_config(array()); - $request = $this->getMock('phpbb_request'); - $user = $this->getMock('phpbb_user'); - - $auth_provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $phpbb_container->expects($this->any()) - ->method('get') - ->with('auth.provider.db') - ->will($this->returnValue($auth_provider)); - - $session_factory = new phpbb_session_testable_factory; - $session_factory->set_cookies(array( - '_sid' => $session_id, - '_u' => $user_id, - )); - $session_factory->merge_config_data(array( - 'session_length' => time(), // need to do this to allow sessions started at time 0 - )); - $session_factory->merge_server_data(array( - 'HTTP_USER_AGENT' => $user_agent, - 'REMOTE_ADDR' => $ip, - )); - - $session = $session_factory->get_session($db); - $session->page = array('page' => 'page', 'forum' => 0); - - $session->session_begin(); - - $sql = 'SELECT session_id, session_user_id - FROM phpbb_sessions - ORDER BY session_user_id'; - - $expected_sessions = $this->replace_session($expected_sessions, $session->session_id); - $expected_cookies = $this->replace_session($expected_cookies, $session->session_id); - - $this->assertSqlResultEquals( - $expected_sessions, - $sql, - $message - ); - - $session->check_cookies($this, $expected_cookies); - - $session_factory->check($this); - } - - /** - * Replaces recursively the value __new_session_id__ with the given session - * id. - * - * @param array $array An array of data - * @param string $session_id The new session id to use instead of the - * placeholder. - * @return array The input array with all occurances of __new_session_id__ - * replaced. - */ - public function replace_session($array, $session_id) - { - foreach ($array as $key => &$value) - { - if ($value === '__new_session_id__') - { - $value = $session_id; - } - - if (is_array($value)) - { - $value = $this->replace_session($value, $session_id); - } - } - - return $array; - } -} diff --git a/tests/session/create_test.php b/tests/session/create_test.php new file mode 100644 index 0000000000..442445599b --- /dev/null +++ b/tests/session/create_test.php @@ -0,0 +1,43 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; + +class phpbb_session_create_test extends phpbb_session_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml'); + } + + static function bot($bot_agent, $user_id, $bot_ip) + { + return array(array( + 'bot_agent' => $bot_agent, + 'user_id' => $user_id, + 'bot_ip' => $bot_ip, + )); + } + + function test_bot_session() + { + $output = $this->session_facade->session_create( + false, + false, + false, + false, + array(), + 'user agent', + '127.0.0.1', + self::bot('user agent', 13, '127.0.0.1'), + '' + ); + $this->assertEquals(true, $output->data['is_bot'], 'should be a bot'); + } +} diff --git a/tests/session/creation_test.php b/tests/session/creation_test.php deleted file mode 100644 index fde76d6b06..0000000000 --- a/tests/session/creation_test.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -require_once dirname(__FILE__) . '/testable_factory.php'; - -class phpbb_session_creation_test extends phpbb_database_test_case -{ - public function getDataSet() - { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); - } - - // also see security/extract_current_page.php - - public function test_login_session_create() - { - global $phpbb_container, $phpbb_root_path, $phpEx; - - $db = $this->new_dbal(); - $config = new phpbb_config(array()); - $request = $this->getMock('phpbb_request'); - $user = $this->getMock('phpbb_user'); - - $auth_provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $phpbb_container->expects($this->any()) - ->method('get') - ->with('auth.provider.db') - ->will($this->returnValue($auth_provider)); - - $session_factory = new phpbb_session_testable_factory; - - $session = $session_factory->get_session($db); - $session->page = array('page' => 'page', 'forum' => 0); - - $session->session_create(3); - - $sql = 'SELECT session_user_id - FROM phpbb_sessions'; - - $this->assertSqlResultEquals( - array(array('session_user_id' => 3)), - $sql, - 'Check if exactly one session for user id 3 was created' - ); - - $one_year_in_seconds = 365 * 24 * 60 * 60; - $cookie_expire = $session->time_now + $one_year_in_seconds; - - $session->check_cookies($this, array( - 'u' => array(null, $cookie_expire), - 'k' => array(null, $cookie_expire), - 'sid' => array($session->session_id, $cookie_expire), - )); - - global $SID, $_SID; - $this->assertEquals($session->session_id, $_SID); - $this->assertEquals('?sid=' . $session->session_id, $SID); - - $session_factory->check($this); - } -} - diff --git a/tests/session/extract_hostname_test.php b/tests/session/extract_hostname_test.php new file mode 100644 index 0000000000..bd183fd438 --- /dev/null +++ b/tests/session/extract_hostname_test.php @@ -0,0 +1,51 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; + +class phpbb_session_extract_hostname_test extends phpbb_session_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml'); + } + + static public function extract_current_hostname_data() + { + return array ( + // [Input] $host, $server_name_config, $cookie_domain_config, [Expected] $output + // If host is ip use that + // ipv4 + array('127.0.0.1', 'skipped.org', 'skipped.org', '127.0.0.1'), + // ipv6 + array('::1', 'skipped.org', 'skipped.org', ':'), + array('2002::3235:51f9', 'skipped.org', 'skipped.org', '2002::3235'), + // If no host but server name matches cookie_domain use that + array('', 'example.org', 'example.org', 'example.org'), + // If there is a host uri use that + array('example.org', false, false, 'example.org'), + // 'best approach' guessing + array('', 'example.org', false, 'example.org'), + array('', false, '127.0.0.1', '127.0.0.1'), + array('', false, false, php_uname('n')), + ); + } + + /** @dataProvider extract_current_hostname_data */ + function test_extract_current_hostname($host, $server_name_config, $cookie_domain_config, $expected) + { + $output = $this->session_facade->extract_current_hostname( + $host, + $server_name_config, + $cookie_domain_config + ); + + $this->assertEquals($expected, $output); + } +} diff --git a/tests/session/extract_page_test.php b/tests/session/extract_page_test.php new file mode 100644 index 0000000000..f4ae8de021 --- /dev/null +++ b/tests/session/extract_page_test.php @@ -0,0 +1,115 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; + +class phpbb_session_extract_page_test extends phpbb_session_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml'); + } + + static public function extract_current_page_data() + { + return array( + array( + './', + '/phpBB/index.php', + '', + '/phpBB/', + array( + 'page_name' => 'index.php', + 'page_dir' => '', + 'query_string' => '', + 'script_path' => '/phpBB/', + 'root_script_path' => '/phpBB/', + 'page' => 'index.php', + 'forum' => 0, + ), + ), + array( + './', + '/phpBB/ucp.php', + 'mode=login', + '/phpBB/ucp.php?mode=login', + array( + 'page_name' => 'ucp.php', + 'page_dir' => '', + 'query_string' => 'mode=login', + 'script_path' => '/phpBB/', + 'root_script_path' => '/phpBB/', + 'page' => 'ucp.php?mode=login', + 'forum' => 0, + ), + ), + array( + './', + '/phpBB/ucp.php', + 'mode=register', + '/phpBB/ucp.php?mode=register', + array( + 'page_name' => 'ucp.php', + 'page_dir' => '', + 'query_string' => 'mode=register', + 'script_path' => '/phpBB/', + 'root_script_path' => '/phpBB/', + 'page' => 'ucp.php?mode=register', + 'forum' => 0, + ), + ), + array( + './', + '/phpBB/ucp.php', + 'mode=register', + '/phpBB/ucp.php?mode=register', + array( + 'page_name' => 'ucp.php', + 'page_dir' => '', + 'query_string' => 'mode=register', + 'script_path' => '/phpBB/', + 'root_script_path' => '/phpBB/', + 'page' => 'ucp.php?mode=register', + 'forum' => 0, + ), + ), + array( + './../', + '/phpBB/adm/index.php', + 'sid=e7215d958cdd41a6fc13509bebe53e42', + '/phpBB/adm/index.php?sid=e7215d958cdd41a6fc13509bebe53e42', + array( + 'page_name' => 'index.php', + //'page_dir' => 'adm', + // ^-- Ignored because .. returns different directory in live vs testing + 'query_string' => '', + 'script_path' => '/phpBB/adm/', + 'root_script_path' => '/phpBB/', + //'page' => 'adm/index.php', + 'forum' => 0, + ), + ), + ); + } + + /** @dataProvider extract_current_page_data */ + function test_extract_current_page($root_path, $php_self, $query_string, $request_uri, $expected) + { + $output = $this->session_facade->extract_current_page( + $root_path, + $php_self, + $query_string, + $request_uri + ); + + // This compares the result of the output. + // Any keys that are not in the expected array are overwritten by the output (aka not checked). + $this->assert_array_content_equals(array_merge($output, $expected), $output); + } +} diff --git a/tests/session/fixtures/sessions_banlist.xml b/tests/session/fixtures/sessions_banlist.xml new file mode 100644 index 0000000000..9422fc0665 --- /dev/null +++ b/tests/session/fixtures/sessions_banlist.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <column>user_occ</column> + <column>user_interests</column> + <row> + <value>1</value> + <value>anonymous</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_sessions"> + <column>session_id</column> + <column>session_user_id</column> + <column>session_ip</column> + <column>session_browser</column> + <column>session_admin</column> + <row> + <value>bar_session000000000000000000000</value> + <value>4</value> + <value>127.0.0.1</value> + <value>user agent</value> + <value>1</value> + </row> + </table> + <table name="phpbb_banlist"> + <column>ban_id</column> + <column>ban_userid</column> + <column>ban_ip</column> + <column>ban_email</column> + <column>ban_start</column> + <column>ban_end</column> + <column>ban_exclude</column> + <column>ban_reason</column> + <column>ban_give_reason</column> + <row> + <value>2</value> + <value>4</value> + <value>127.0.0.1</value> + <value>bar@example.org</value> + <value>1111</value> + <value>0</value> + <value>0</value> + <value>HAHAHA</value> + <value>1</value> + </row> + <row> + <value>3</value> + <value>0</value> + <value>127.1.1.1</value> + <value></value> + <value>1111</value> + <value>0</value> + <value>0</value> + <value>HAHAHA</value> + <value>1</value> + </row> + </table> +</dataset> diff --git a/tests/session/fixtures/sessions_full.xml b/tests/session/fixtures/sessions_full.xml index 509687f4d2..6bbaf1c9d5 100644 --- a/tests/session/fixtures/sessions_full.xml +++ b/tests/session/fixtures/sessions_full.xml @@ -37,17 +37,20 @@ <column>session_user_id</column> <column>session_ip</column> <column>session_browser</column> + <column>session_admin</column> <row> <value>anon_session00000000000000000000</value> <value>1</value> <value>127.0.0.1</value> <value>anonymous user agent</value> + <value>0</value> </row> <row> <value>bar_session000000000000000000000</value> <value>4</value> <value>127.0.0.1</value> <value>user agent</value> + <value>1</value> </row> </table> </dataset> diff --git a/tests/session/fixtures/sessions_garbage.xml b/tests/session/fixtures/sessions_garbage.xml new file mode 100644 index 0000000000..23c44a975b --- /dev/null +++ b/tests/session/fixtures/sessions_garbage.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <column>user_occ</column> + <column>user_interests</column> + <row> + <value>4</value> + <value>bar</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_sessions"> + <column>session_id</column> + <column>session_user_id</column> + <column>session_ip</column> + <column>session_browser</column> + <column>session_admin</column> + <row> + <value>anon_session00000000000000000000</value> + <value>1</value> + <value>127.0.0.1</value> + <value>anonymous user agent</value> + <value>0</value> + </row> + <row> + <value>bar_session000000000000000000000</value> + <value>4</value> + <value>127.0.0.1</value> + <value>user agent</value> + <value>1</value> + </row> + </table> + <table name="phpbb_login_attempts"> + <column>attempt_ip</column> + <column>attempt_browser</column> + <column>attempt_forwarded_for</column> + <column>attempt_time</column> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <row> + <value>127.0.0.1</value> + <value>browser</value> + <value></value> + <value>0001</value> + <value>4</value> + <value>bar</value> + <value>bar</value> + </row> + </table> +</dataset> diff --git a/tests/session/fixtures/sessions_key.xml b/tests/session/fixtures/sessions_key.xml new file mode 100644 index 0000000000..246d284557 --- /dev/null +++ b/tests/session/fixtures/sessions_key.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_sessions_keys"> + <column>key_id</column> + <column>user_id</column> + <column>last_ip</column> + <column>last_login</column> + <row> + <value>a87ff679a2f3e71d9181a67b7542122c</value> + <value>4</value> + <value>127.0.0.1</value> + <value>0</value> + </row> + </table> + <table name="phpbb_sessions"> + <column>session_id</column> + <column>session_user_id</column> + <column>session_ip</column> + <column>session_browser</column> + <row> + <value>bar_session000000000000000000000</value> + <value>4</value> + <value>127.0.0.1</value> + <value>user agent</value> + <value>1</value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <column>user_occ</column> + <column>user_interests</column> + <row> + <value>4</value> + <value>bar</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php new file mode 100644 index 0000000000..e7d01785dd --- /dev/null +++ b/tests/session/garbage_collection_test.php @@ -0,0 +1,53 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; + +class phpbb_session_garbage_collection_test extends phpbb_session_test_case +{ + public $session; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_garbage.xml'); + } + + public function setUp() + { + parent::setUp(); + $this->session = $this->session_factory->get_session($this->db); + } + + public function test_cleanup_all() + { + $this->check_sessions_equals( + array( + array( + 'session_id' => 'anon_session00000000000000000000', + 'session_user_id' => 1, + ), + array( + 'session_id' => 'bar_session000000000000000000000', + 'session_user_id' => 4, + ), + ), + 'Before test, should have some sessions.' + ); + // Set session length so it clears all + global $config; + $config['session_length'] = 0; + // There is an error unless the captcha plugin is set + $config['captcha_plugin'] = 'phpbb_captcha_nogd'; + $this->session->session_gc(); + $this->check_sessions_equals( + array(), + 'After setting session time to 0, should remove all.' + ); + } +} diff --git a/tests/session/session_key_test.php b/tests/session/session_key_test.php new file mode 100644 index 0000000000..1cf2101385 --- /dev/null +++ b/tests/session/session_key_test.php @@ -0,0 +1,51 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; + +class phpbb_session_login_keys_test extends phpbb_session_test_case +{ + protected $user_id = 4; + protected $key_id = 4; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_key.xml'); + } + + public function test_set_key_manually() + { + // With AutoLogin setup + $this->session_factory->merge_config_data(array('allow_autologin' => true)); + $session = $this->session_factory->get_session($this->db); + // Using a user_id and key that is already in the database + $session->cookie_data['u'] = $this->user_id; + $session->cookie_data['k'] = $this->key_id; + // Try to access session + $session->session_create($this->user_id, false, $this->user_id); + + $this->assertEquals($this->user_id, $session->data['user_id'], "session should automatically login"); + } + + public function test_reset_keys() + { + // With AutoLogin setup + $this->session_factory->merge_config_data(array('allow_autologin' => true)); + $session = $this->session_factory->get_session($this->db); + // Reset of the keys for this user + $session->reset_login_keys($this->user_id); + // Using a user_id and key that was in the database (before reset) + $session->cookie_data['u'] = $this->user_id; + $session->cookie_data['k'] = $this->key_id; + // Try to access session + $session->session_create($this->user_id, false, $this->user_id); + + $this->assertNotEquals($this->user_id, $session->data['user_id'], "session should be cleared"); + } +} diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php new file mode 100644 index 0000000000..9f0a3c5f59 --- /dev/null +++ b/tests/session/testable_facade.php @@ -0,0 +1,142 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/testable_factory.php'; +require_once dirname(__FILE__) . '/../../phpBB/phpbb/session.php'; + +/** + * This class exists to expose session.php's functions in a more testable way. + * + * Since many functions in session.php have global variables inside the function, + * this exposes those functions through a testable facade that uses + * testable_factory's mock global variables to modify global variables used in + * the functions. + * + * This is using the facade pattern to provide a testable "front" to the + * functions in sessions.php. + * + */ +class phpbb_session_testable_facade +{ + protected $db; + protected $session_factory; + + function __construct($db, $session_factory) + { + $this->db = $db; + $this->session_factory = $session_factory; + } + + function extract_current_page( + $root_path, + $php_self, + $query_string, + $request_uri + ) + { + $this->session_factory->get_session($this->db); + global $request; + $request->overwrite('PHP_SELF', $php_self, phpbb_request_interface::SERVER); + $request->overwrite('QUERY_STRING', $query_string, phpbb_request_interface::SERVER); + $request->overwrite('REQUEST_URI', $request_uri, phpbb_request_interface::SERVER); + return phpbb_session::extract_current_page($root_path); + } + + function extract_current_hostname( + $host, + $server_name_config, + $cookie_domain_config + ) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + $config['server_name'] = $server_name_config; + $config['cookie_domain'] = $cookie_domain_config; + $request->overwrite('SERVER_NAME', $host, phpbb_request_interface::SERVER); + $request->overwrite('Host', $host, phpbb_request_interface::SERVER); + // Note: There is a php_uname function used as a fallthrough + // that this function doesn't override + return $session->extract_current_hostname(); + } + + /** + * + * This function has a lot of dependencies, so instead of naming them all, + * just ask for overrides + * + * @param update_session_page Boolean of whether to set page of the session + * @param config_overrides An array of overrides for the global config object + * @param request_overrides An array of overrides for the global request object + * @return boolean False if the user is identified, otherwise true. + */ + function session_begin( + $update_session_page = true, + $config_overrides = array(), + $request_overrides = array(), + $cookies_overrides = array() + ) + { + $this->session_factory->merge_config_data($config_overrides); + $this->session_factory->merge_server_data($request_overrides); + $this->session_factory->set_cookies($cookies_overrides); + $session = $this->session_factory->get_session($this->db); + $session->session_begin($update_session_page); + return $session; + } + + function session_create( + $user_id = false, + $set_admin = false, + $persist_login = false, + $viewonline = true, + array $config_overrides = array(), + $user_agent = 'user agent', + $ip_address = '127.0.0.1', + array $bot_overrides = array(), + $uri_sid = "" + ) + { + $this->session_factory->merge_config_data($config_overrides); + // Bots + $this->session_factory->merge_cache_data(array('_bots' => $bot_overrides)); + global $request; + $session = $this->session_factory->get_session($this->db); + $session->browser = $user_agent; + $session->ip = $ip_address; + // Uri sid + if ($uri_sid) + { + $_GET['sid'] = $uri_sid; + } + $session->session_create($user_id, $set_admin, $persist_login, $viewonline); + return $session; + } + + function validate_referer( + $check_script_path, + $referer, + $host, + $force_server_vars, + $server_port, + $server_name, + $root_script_path + ) + { + $session = $this->session_factory->get_session($this->db); + global $config, $request; + $session->referer = $referer; + $session->page['root_script_path'] = $root_script_path; + $session->host = $host; + $config['force_server_vars'] = $force_server_vars; + $config['server_name'] = $server_name; + $request->overwrite('SERVER_PORT', $server_port, phpbb_request_interface::SERVER); + return $session->validate_referer($check_script_path); + } +} + diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php index 1e2b194ece..8733ce15ef 100644 --- a/tests/session/testable_factory.php +++ b/tests/session/testable_factory.php @@ -2,11 +2,14 @@ /** * * @package testing -* @copyright (c) 2011 phpBB Group +* @copyright (c) 2013 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ +require_once dirname(__FILE__) . '/../mock/container_builder.php'; +require_once dirname(__FILE__) . '/../mock/auth_provider.php'; + /** * This class exists to setup an instance of phpbb's session class for testing. * @@ -16,6 +19,7 @@ */ class phpbb_session_testable_factory { + protected $container; protected $config_data; protected $cache_data; protected $cookies; @@ -65,7 +69,7 @@ class phpbb_session_testable_factory public function get_session(phpbb_db_driver $dbal) { // set up all the global variables used by session - global $SID, $_SID, $db, $config, $cache, $request; + global $SID, $_SID, $db, $config, $cache, $request, $phpbb_container; $request = $this->request = new phpbb_mock_request( array(), @@ -83,6 +87,12 @@ class phpbb_session_testable_factory $cache = $this->cache = new phpbb_mock_cache($this->get_cache_data()); $SID = $_SID = null; + $phpbb_container = $this->container = new phpbb_mock_container_builder(); + $phpbb_container->set( + 'auth.provider.db', + new phpbb_mock_auth_provider() + ); + $session = new phpbb_mock_session_testable; return $session; } @@ -165,6 +175,32 @@ class phpbb_session_testable_factory } /** + * Set cookies, merge config and server data in one step. + * + * New values overwrite old ones. + * + * @param $session_id + * @param $user_id + * @param $user_agent + * @param $ip + * @param int $time + */ + public function merge_test_data($session_id, $user_id, $user_agent, $ip, $time = 0) + { + $this->set_cookies(array( + '_sid' => $session_id, + '_u' => $user_id, + )); + $this->merge_config_data(array( + 'session_length' => time() + $time, // need to do this to allow sessions started at time 0 + )); + $this->merge_server_data(array( + 'HTTP_USER_AGENT' => $user_agent, + 'REMOTE_ADDR' => $ip, + )); + } + + /** * Retrieve all server variables to be passed to the session. * * @return array Server variables diff --git a/tests/session/unset_admin_test.php b/tests/session/unset_admin_test.php new file mode 100644 index 0000000000..1d5b1759ab --- /dev/null +++ b/tests/session/unset_admin_test.php @@ -0,0 +1,48 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; + +class phpbb_session_unset_admin_test extends phpbb_session_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml'); + } + + function get_test_session() + { + return $this->session_facade->session_begin( + true, + // Config + array( + 'session_length' => time(), // need to do this to allow sessions started at time 0 + ), + // Server + array( + 'HTTP_USER_AGENT' => "user agent", + 'REMOTE_ADDR' => "127.0.0.1", + ), + // Cookies + array( + '_sid' => 'bar_session000000000000000000000', + '_u' => 4, + ) + ); + } + + public function test_unset_admin() + { + $session = $this->get_test_session(); + $this->assertEquals(1, $session->data['session_admin'], 'should be an admin before test starts'); + $session->unset_admin(); + $session = $this->get_test_session(); + $this->assertEquals(0, $session->data['session_admin'], 'should be not be an admin after unset_admin'); + } +} diff --git a/tests/session/validate_referrer_test.php b/tests/session/validate_referrer_test.php new file mode 100644 index 0000000000..a302229287 --- /dev/null +++ b/tests/session/validate_referrer_test.php @@ -0,0 +1,70 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; + +class phpbb_session_validate_referrer_test extends phpbb_session_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_empty.xml'); + } + + static function referrer_inputs() + { + $ex = "example.org"; + $alt = "example.com"; + return array( + // checkpath referrer host forcevars port servername rootpath pass? + // 0 Referrer or host wasn't collected, therefore should validate + array(false, '', $ex, false, 80, $ex, '', true), + array(false, $ex, '', false, 80, $ex, '', true), + // 2 Referrer doesn't match host or server_name + array(false, $alt, $ex, false, 80, $ex, '', false), + // 3 Everything should check out + array(false, $ex, $ex, false, 80, $ex, '', true), + // 4 Check Script Path + array(true, $ex, $ex, false, 80, $ex, '', true), + array(true, "$ex/foo", $ex, false, 80, $ex, "/foo", true), + array(true, "$ex/bar", $ex, false, 80, $ex, "/foo", false), + // 7 Port (This is not checked unless path is checked) + array(true, "$ex:80/foo", "$ex:80", false, 80, "$ex:80", "/foo", true), + array(true, "$ex:80/bar", "$ex:80", false, 80, "$ex:80", "/foo", false), + array(true, "$ex:79/foo", "$ex:81", false, 81, "$ex:81", "/foo", false), + ); + } + + /** @dataProvider referrer_inputs */ + function test_referrer_inputs( + $check_script_path, + $referrer, + $host, + $force_server_vars, + $server_port, + $server_name, + $root_script_path, + $pass_or_fail + ) + { + // Referrer needs http:// because it's going to get stripped in function. + $referrer = $referrer ? 'http://' . $referrer : ''; + $this->assertEquals( + $pass_or_fail, + $this->session_facade->validate_referer( + $check_script_path, + $referrer, + $host, + $force_server_vars, + $server_port, + $server_name, + $root_script_path + ), + "referrer should" . ($pass_or_fail ? '' : "n't") . " be validated"); + } +} diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test.html index 3eb906a09e..3eb906a09e 100644 --- a/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/kappa/styles/all/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test.html index 3b65d80a6d..3b65d80a6d 100644 --- a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/test.html b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test.html index 26826d59e3..26826d59e3 100644 --- a/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/kappa/styles/silver_inherit/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test.html index 003d193dc3..003d193dc3 100644 --- a/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/omega/styles/all/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/test.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test.html index 6bf06f5457..6bf06f5457 100644 --- a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/test.html diff --git a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/two.html b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two.html index 7f8058f4e4..7f8058f4e4 100644 --- a/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/two.html +++ b/tests/template/datasets/event_inheritance/ext/omega/styles/silver/template/event/two.html diff --git a/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/test.html b/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test.html index 5fc7e5ac12..5fc7e5ac12 100644 --- a/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/test.html +++ b/tests/template/datasets/event_inheritance/ext/zeta/styles/all/template/event/test.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event_variable_spacing.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing.html index 028f8aa0d1..028f8aa0d1 100644 --- a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event_variable_spacing.html +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/event_variable_spacing.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop.html new file mode 100644 index 0000000000..235e129f85 --- /dev/null +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_loop.html @@ -0,0 +1 @@ +{event_loop.S_ROW_COUNT}<!-- IF not event_loop.S_LAST_ROW -->|<!-- ENDIF --> diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/universal.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal.html index f2c5762ade..f2c5762ade 100644 --- a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/universal.html +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/universal.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/simple.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple.html index fe32a1ed3f..fe32a1ed3f 100644 --- a/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/simple.html +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/silver/template/event/simple.html diff --git a/tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html b/tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html new file mode 100644 index 0000000000..c70d8f86d7 --- /dev/null +++ b/tests/template/datasets/ext_trivial/styles/silver/template/event_loop.html @@ -0,0 +1,3 @@ +<!-- BEGIN event_loop --> +event_loop<!-- EVENT test_event_loop --> +<!-- END event_loop --> diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php index ff7b890d11..a0dd8368cf 100644 --- a/tests/template/includephp_test.php +++ b/tests/template/includephp_test.php @@ -46,7 +46,7 @@ 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(), ''); + $this->template->set_custom_style('tests', $cache_dir); $this->run_template('includephp_absolute.html', array(), array(), array(), "Path is absolute.\ntesting included php"); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index f7bcd2dcc6..4280a7e7ff 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -80,6 +80,16 @@ Zeta test event in all', array(), 'two in silver in omega', ), + array( + 'EVENT in loop', + 'ext_trivial', + array('silver'), + 'event_loop.html', + array(), + array('event_loop' => array(array(), array(), array())), + array(), + 'event_loop0|event_loop1|event_loop2', + ), ); } @@ -103,13 +113,10 @@ Zeta test event in all', $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_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, ''); + $this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path)); } } diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 802f0c19ba..38eb072df8 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -64,6 +64,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case ), array( 'if.html', + array('S_OTHER_OTHER_VALUE' => true), + array(), + array(), + '|S_OTHER_OTHER_VALUE|!false', + ), + array( + 'if.html', array('S_VALUE' => false, 'S_OTHER_VALUE' => true), array(), array(), @@ -93,49 +100,49 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop.html', array(), - array('loop' => array(array())), + array('test_loop' => array(array())), array(), "loop\nloop", ), array( 'loop.html', array(), - array('loop' => array(array(), array()), 'loop.block' => array(array())), + array('test_loop' => array(array(), array()), 'test_loop.block' => array(array())), array(), "loop\nloop\nloop\nloop", ), array( 'loop.html', array(), - array('loop' => array(array(), array()), 'loop.block' => array(array()), 'block' => array(array(), array())), + array('test_loop' => array(array(), array()), 'test_loop.block' => array(array()), 'block' => array(array(), array())), array(), "loop\nloop\nloop\nloop\nloop#0-block#0\nloop#0-block#1\nloop#1-block#0\nloop#1-block#1", ), array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'))), + array('test_loop' => array(array('VARIABLE' => 'x'))), array(), "first\n0 - a\nx - b\nset\nlast", ), array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))), array(), "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast", ), array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), array(), "first\n0 - a\nx - b\nset\n1 - a\ny - b\nset\nlast\n0 - c\n1 - c\nlast inner", ), array( 'loop_advanced.html', array(), - array('loop' => array(array(), array(), array(), array(), array(), array(), array())), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array())), array(), "101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561", ), @@ -149,14 +156,14 @@ class phpbb_template_template_test extends phpbb_template_template_test_case 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())), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), array(), - "xyz\nabc\nabc\nbar\nbar\nabc", + "xyz\nabc\n\$VALUE == 'abc'abc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?", ), array( 'define_advanced.html', array(), - array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), + array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), array(), "abc\nzxc\ncde\nbcd", ), @@ -200,7 +207,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'include_loop.html', array(), - array('loop' => array(array('NESTED_FILE' => 'include_loop1.html')), 'loop.inner' => array(array('NESTED_FILE' => 'include_loop1.html'), array('NESTED_FILE' => 'include_loop2.html'), array('NESTED_FILE' => 'include_loop3.html'))), + array('test_loop' => array(array('NESTED_FILE' => 'include_loop1.html')), 'test_loop.inner' => array(array('NESTED_FILE' => 'include_loop1.html'), array('NESTED_FILE' => 'include_loop2.html'), array('NESTED_FILE' => 'include_loop3.html'))), array(), "1\n_1\n_02\n_3", ), @@ -221,8 +228,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), - array('loop'), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), + array('test_loop'), '', ), array( @@ -235,7 +242,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'include_loop_define.html', array('VARIABLE' => 'value'), - array('loop' => array(array('NESTED_FILE' => 'variable.html'))), + array('test_loop' => array(array('NESTED_FILE' => 'variable.html'))), array(), 'value', ), @@ -243,8 +250,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop_vars.html', array(), - array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), - array('loop.inner'), + array('test_loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'test_loop.inner' => array(array(), array())), + array('test_loop.inner'), "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast", ),*/ array( @@ -295,7 +302,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array( 'loop_size.html', array(), - array('loop' => array(array()), 'empty_loop' => array()), + array('test_loop' => array(array()), 'empty_loop' => array()), array(), "nonexistent = 0\n! nonexistent\n\nempty = 0\n! empty\nloop\n\nin loop", ), @@ -410,7 +417,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case $this->setup_engine(array('tpl_allow_php' => true)); - $this->style->set_custom_style('tests', $cache_dir, array(), ''); + $this->template->set_custom_style('tests', $cache_dir); $this->run_template('php.html', array(), array(), array(), 'test'); } diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 6d87e5ebc0..91895502ad 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -11,11 +11,8 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_template_template_test_case extends phpbb_test_case { - protected $style; protected $template; protected $template_path; - protected $style_resource_locator; - protected $style_provider; protected $user; protected $test_path = 'tests/template'; @@ -67,11 +64,8 @@ class phpbb_template_template_test_case extends phpbb_test_case $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_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(), ''); + $this->template->set_custom_style('tests', $this->template_path); } protected function setUp() diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 4b8cbada45..477192c28a 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -20,10 +20,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat $this->template_path = $this->test_path . '/templates'; $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_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(), ''); + $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path)); } } diff --git a/tests/template/templates/define.html b/tests/template/templates/define.html index 4e6d0ee793..66e874ca63 100644 --- a/tests/template/templates/define.html +++ b/tests/template/templates/define.html @@ -2,8 +2,15 @@ {$VALUE} <!-- DEFINE $VALUE = 'abc' --> {$VALUE} +<!-- IF $VALUE != 'abc' --> +$VALUE != 'abc' +<!-- ELSEIF $VALUE == 'abc' --> +$VALUE == 'abc' +<!-- ENDIF --> <!-- INCLUDE define_include.html --> {$INCLUDED_VALUE} {$VALUE} <!-- UNDEFINE $VALUE --> {$VALUE} +<!-- DEFINE $VALUE = 'test!@#$%^&*()_-=+{}[]:;",<.>/?' --> +{$VALUE} diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html index c010aff7fa..f6ab6e575a 100644 --- a/tests/template/templates/if.html +++ b/tests/template/templates/if.html @@ -2,6 +2,8 @@ 1 <!-- ELSEIF S_OTHER_VALUE --> 2 +<!-- ELSE IF S_OTHER_OTHER_VALUE --> +|S_OTHER_OTHER_VALUE| <!-- ELSE --> 03 <!-- ENDIF --> diff --git a/tests/template/templates/include_loop.html b/tests/template/templates/include_loop.html index d5c3d9bc82..5cad34b363 100644 --- a/tests/template/templates/include_loop.html +++ b/tests/template/templates/include_loop.html @@ -1,4 +1,4 @@ -<!-- BEGIN loop --> -<!-- INCLUDE {loop.NESTED_FILE} --> -<!-- BEGIN inner -->_<!-- INCLUDE {inner.NESTED_FILE} --><!-- END inner --> -<!-- END loop --> +<!-- BEGIN test_loop --> +<!-- INCLUDE {test_loop.NESTED_FILE} --> +<!-- BEGIN inner -->_<!-- INCLUDE {test_loop.inner.NESTED_FILE} --><!-- END inner --> +<!-- END test_loop --> diff --git a/tests/template/templates/include_loop_define.html b/tests/template/templates/include_loop_define.html index f539b21396..4bab09422e 100644 --- a/tests/template/templates/include_loop_define.html +++ b/tests/template/templates/include_loop_define.html @@ -1,4 +1,4 @@ -<!-- BEGIN loop --> -<!-- DEFINE $DEF = '{loop.NESTED_FILE}' --> +<!-- BEGIN test_loop --> +<!-- DEFINE $DEF = '{test_loop.NESTED_FILE}' --> <!-- INCLUDE {$DEF} --> -<!-- END loop --> +<!-- END test_loop --> diff --git a/tests/template/templates/loop.html b/tests/template/templates/loop.html index de1a10004d..f541e934df 100644 --- a/tests/template/templates/loop.html +++ b/tests/template/templates/loop.html @@ -1,21 +1,21 @@ -<!-- BEGIN loop --> +<!-- BEGIN test_loop --> loop <!-- BEGINELSE --> noloop -<!-- END loop --> +<!-- END test_loop --> -<!-- IF .loop --> +<!-- IF .test_loop --> loop <!-- ELSE --> noloop <!-- ENDIF --> -<!-- IF .loop == 2 --> +<!-- IF .test_loop == 2 --> loop <!-- ENDIF --> -<!-- BEGIN loop --> +<!-- BEGIN test_loop --> <!-- BEGIN !block --> -loop#{loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT} +loop#{test_loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT} <!-- END !block --> -<!-- END loop --> +<!-- END test_loop --> diff --git a/tests/template/templates/loop_advanced.html b/tests/template/templates/loop_advanced.html index c75fe55f03..1f56686eaa 100644 --- a/tests/template/templates/loop_advanced.html +++ b/tests/template/templates/loop_advanced.html @@ -1,19 +1,19 @@ -<!-- BEGIN loop -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(0) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(0) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(0,-1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(0,-1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(1,1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(1,1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(0,1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(0,1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(2,4) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(2,4) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(0,-7) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(0,-7) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(-2,6) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(-2,6) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> x -<!-- BEGIN loop(-2,-1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop --> +<!-- BEGIN test_loop(-2,-1) -->{test_loop.S_FIRST_ROW}{test_loop.S_ROW_COUNT}{test_loop.S_LAST_ROW}<!-- END test_loop --> diff --git a/tests/template/templates/loop_size.html b/tests/template/templates/loop_size.html index 8f581cef10..2b1fcd2dd4 100644 --- a/tests/template/templates/loop_size.html +++ b/tests/template/templates/loop_size.html @@ -22,18 +22,18 @@ ! empty <!-- ENDIF --> -<!-- IF .loop --> +<!-- IF .test_loop --> loop <!-- ENDIF --> -<!-- IF .loop == 0 --> +<!-- IF .test_loop == 0 --> loop = 0 <!-- ENDIF --> -<!-- IF ! .loop --> +<!-- IF ! .test_loop --> ! loop <!-- ENDIF --> -<!-- BEGIN loop --> +<!-- BEGIN test_loop --> in loop -<!-- END loop --> +<!-- END test_loop --> diff --git a/tests/template/templates/loop_vars.html b/tests/template/templates/loop_vars.html index 7d86d4b7b6..70a3eb2cec 100644 --- a/tests/template/templates/loop_vars.html +++ b/tests/template/templates/loop_vars.html @@ -1,13 +1,13 @@ -<!-- BEGIN loop --> -<!-- IF loop.S_FIRST_ROW -->first<!-- ENDIF --> -{loop.S_ROW_NUM} - a -{loop.VARIABLE} - b -<!-- IF loop.VARIABLE -->set<!-- ENDIF --> -<!-- IF loop.S_LAST_ROW --> +<!-- BEGIN test_loop --> +<!-- IF test_loop.S_FIRST_ROW -->first<!-- ENDIF --> +{test_loop.S_ROW_NUM} - a +{test_loop.VARIABLE} - b +<!-- IF test_loop.VARIABLE -->set<!-- ENDIF --> +<!-- IF test_loop.S_LAST_ROW --> last <!-- ENDIF --> <!-- BEGIN inner --> -{inner.S_ROW_NUM} - c -<!-- IF inner.S_LAST_ROW and inner.S_ROW_COUNT and inner.S_NUM_ROWS -->last inner<!-- ENDIF --> +{test_loop.inner.S_ROW_NUM} - c +<!-- IF test_loop.inner.S_LAST_ROW and test_loop.inner.S_ROW_COUNT and test_loop.inner.S_NUM_ROWS -->last inner<!-- ENDIF --> <!-- END inner --> -<!-- END loop --> +<!-- END test_loop --> diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index ed307c3ce2..ce748bb9cf 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -747,6 +747,27 @@ class phpbb_functional_test_case extends phpbb_test_case self::assertStringStartsWith('<!DOCTYPE', trim($content), 'Output found before DOCTYPE specification.'); } + /* + * Perform some basic assertions for an xml page + * + * Checks for debug/error output before the actual page content and the status code + * + * @param mixed $status_code Expected status code, false to disable check + * @return null + */ + static public function assert_response_xml($status_code = 200) + { + if ($status_code !== false) + { + self::assert_response_status_code($status_code); + } + + // Any output before the xml opening means there was an error + $content = self::$client->getResponse()->getContent(); + self::assertNotContains('[phpBB Debug]', $content); + self::assertStringStartsWith('<?xml', trim($content), 'Output found before XML specification.'); + } + /** * Heuristic function to check that the response is success. * @@ -936,7 +957,7 @@ class phpbb_functional_test_case extends phpbb_test_case ); } - /* + /** * Returns the requested parameter from a URL * * @param string $url diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php new file mode 100644 index 0000000000..e6a2b03bba --- /dev/null +++ b/tests/test_framework/phpbb_session_test_case.php @@ -0,0 +1,36 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2013 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +require_once dirname(__FILE__) . '/../session/testable_factory.php'; +require_once dirname(__FILE__) . '/../session/testable_facade.php'; + +abstract class phpbb_session_test_case extends phpbb_database_test_case +{ + protected $session_factory; + protected $session_facade; + protected $db; + + function setUp() + { + parent::setUp(); + $this->session_factory = new phpbb_session_testable_factory; + $this->db = $this->new_dbal(); + $this->session_facade = + new phpbb_session_testable_facade($this->db, $this->session_factory); + } + + protected function check_sessions_equals($expected_sessions, $message) + { + $sql = 'SELECT session_id, session_user_id + FROM phpbb_sessions + ORDER BY session_user_id'; + + $this->assertSqlResultEquals($expected_sessions, $sql, $message); + } +} diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php new file mode 100644 index 0000000000..a157fe7d9a --- /dev/null +++ b/tests/text_processing/generate_text_for_display_test.php @@ -0,0 +1,38 @@ +<?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_content.php'; +require_once dirname(__FILE__) . '/../mock/user.php'; +require_once dirname(__FILE__) . '/../mock/cache.php'; + +class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_case +{ + public function setUp() + { + global $cache, $user; + + parent::setUp(); + + $cache = new phpbb_mock_cache; + + $user = new phpbb_mock_user; + $user->optionset('viewcensors', false); + } + + public function test_empty_string() + { + $this->assertSame('', generate_text_for_display('', '', '', 0)); + } + + public function test_zero_string() + { + $this->assertSame('0', generate_text_for_display('0', '', '', 0)); + } +} 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-postgres-travis.xml b/travis/phpunit-postgres-travis.xml index 9f281b4c21..c397882d3c 100644 --- a/travis/phpunit-postgres-travis.xml +++ b/travis/phpunit-postgres-travis.xml @@ -17,9 +17,6 @@ <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> </testsuite> |